Finding index in string

Qutyquteshweta
Posted by Qutyquteshweta under C# category on | Points: 40 | Views : 138
private int FindPositionIndexOf(string textForSearch, char characterToFind, int position)
{
int indx = -1;
for (int i = 0; i < position; i++)
{
indx = textForSearch.IndexOf(characterToFind, indx + 1);
if (indx == -1)
break;
}
return indx;
}

Comments or Responses

Login to post response