But for now im keeping on my own code cuz i want also to learn the way i started to do it.
So what i did so far is:
Expand|Select|Wrap|Line Numbers
- private void inloop()
- {
- while (true)
- {
- y = @"d:\test.txt";
- readers = new StreamReader(y);
- string ff = readers.ReadToEnd();
- index = ff.IndexOf("1", index+1);
- if (index == -1)
- {
- break;
- }
- index1 = ff.IndexOf("3", index);
- string g = ff.Substring(index,index1-index+1);
- substring1 = ff.Substring(0, index);
- substring2 = ff.Substring(index + g.Length, ff.Length - (substring1.Length + g.Length));
- string test = substring1 + substring2;
- MessageBox.Show("Results : " + test);
- }
- }
This is the text in the text file: "dann123ylip123sharon123daniel"
The problem is with substring2 > substring2 = ff.Substring(index + g.Length, ff.Length - (substring1.Length + g.Length));
In substring1 im getting the first part of the name wich is "dann" but then on the substring2 im getting > "ylip123sharon123daniel"
Wich isnt good cuz i want that test in the end will contain > "dannylipsharondaniel"
So what am i doing wrong here in substring2 ?
And please keep on my own code since i want to learn how to do it the way i started.
Thanks.