Hello,
I wonder if there is any faster method to find an index of an occurence within a string?
The .IndexOf method in the below test, takes approx: 1050 milliseconds.
Why this is interesting is that I have code that uses .IndexOf on perheps 100 places
and have loops that could exeed billions of iterations.
Thank you!
//Approx: 1050 milliseconds
DateTime dt = DateTime.Now;
String str = " hello hello.. ,0";
int loops = 4250000;
for (int i = 0; i < loops; i++)
{
index = str.IndexOf(",", 0);
}
DateTime dt2 = DateTime.Now;
TimeSpan diff = dt2 - dt;
MessageBox.Show(diff.TotalMilliseconds.ToString());