Extension method to find the index of the Nth occurrence of a character in a string.
public static int NthIndexOf(string s, char c, int n)
The index of the Nth occurrence if found or -1 if not.
s The string to search.
c The character to find.
n The occurrence to find.
Taken from Wayne Maurer's solution at http://stackoverflow.com/questions/2571716/find-nth-occurrence-of-a-character-in-a-string
See also:Class StringFunctions
© Stonefield Software Inc., 2019 • Updated: 02/12/16
Comment or report problem with topic