ServiceClientGenerator.Utils.IndexOfNthOccurence C# (CSharp) Method

IndexOfNthOccurence() public static method

public static IndexOfNthOccurence ( this self, char value, int startIndex, int n ) : int
self this
value char
startIndex int
n int
return int
        public static int IndexOfNthOccurence(this string self, char value, int startIndex, int n)
        {
            int index = startIndex;
            for (int i = 0; i < n; i++)
            {
                index = self.IndexOf(value, index) + 1;
                if (index < 0)
                    return index;
            }

            return index;
        }