private void test()
{
int index = 0;
int length = 0;
while (true)
{
index = f.IndexOf("Text", index + 1);
if (index == -1)
{
break;
}
int t = f.IndexOf("<", index);
int e = f.IndexOf("/", t);
string g = f.Substring(index , f.Length - t);
}
}
The text file im trying to get the string out from is content:
daniel<Text>THISISOUTisthere</Text>
<Text>hellobye</Text>
<Text>danielTHISishereandnotthere</Text>
danie <Text> is THIS here and not THERE</Text>
In the end i want that g will contain each time the text between the tags Text and the tag Text in the end i cant write here the symbole lower then and upper then but i want to get only the text between this two tags according to to my code. using:
<Text> and </Text> tags
Thanks for the help.
Assuming that you really want to do it this way and not use
XmlTextReader, which is fine – sometimes it’s fun to roll your own solution, you might try something like this. I didn’t test it but it’s probably close, if I understand what you want to do: