For example i have this:
"Was? Wo war ich? Ach ja.<pa>">
I need to create a new text file that will contain only:
Was? Wo war ich? Ach ja.
And i have a big file like 43mb and i need to scan all over the file and get only the places that start with "
and end with <pa>"
and to get the string between this tags.
I did this code so far:
private void retrivingTestText()
{
w = new StreamWriter(retrivedTextFile);
string startTag = "\"";
string endTag = "<pa>";
int startTagWidth = startTag.Length;
int endTagWidth = endTag.Length;
string text = "\"Was? Wo war ich? Ach ja.<pa>\">";
int begin = text.IndexOf(startTag);
int end = text.IndexOf(endTag, begin + 1);
string result = text.Substring(begin+1, end-1);
w.WriteLine(result);
w.Close();
}
But now i need to make it on a big file 43mb xml file. So in the constructor i already did StreamReader r; And string f; Then i did :
r = new StreamReader(@"D:\New folder (22)\000004aa.xml")
f = r.ReadToEnd();
Now i need to use it with the code above to extract all the strings in the big file between the startTag and endTag and not only specific text.
Second thing i need to make another function so after i make changes it will know to add back all the extractes text strings to the right places where it was before between the startTag and the endTag
Thanks.