DEV Community


Discussion on: What happens when you IndexOf an empty string?

turnerj profile image
James Turner Author

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.

Forem Open with the Forem app