re: What happens when you IndexOf an empty string? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: You can give position as indexOf second parameter. This gives a plausible little case where you can figure out the length of a string without using...
 

Interesting idea using it to find out the length though that trick only works for JavaScript. In C#, you get an ArgumentOutOfRangeException unless you specify the start position to be within the length of the string.

I'm not sure how useful it would be for finding the position between characters as it can only tell you what the start position was.

code of conduct - report abuse