See the list of the
String.IndexOf Method (System)[
^] overloads. The official documentation is always the first to be read when being unsure. It contains also often a list of related functions that might do what you want when the initial one does not.
If you want to search for ", ", use one of the
IndexOf
methods accepting a string:
Quote:
Reports the zero-based index of the first occurrence of the specified string in the current String object.
Note also that it is not necessary to use an overload accepting a
comparisonType
for a search string containing only ASCII characters.
If you want to search for more complex cases (like a comma optionally followed by one or more spaces), have a look at regular expressions. But when a task can be done with a basic function like here, use that.