+ 1
Strings
How can I use IndexOf to search in a string?
1 Resposta
+ 3
String s = "SoloLearn earns good vibes";
int pos = s.IndexOf("ear");
Console.WriteLine(pos);
// IndexOf method returns the offset of the given
// argument within a String object
// Offset is a zero based positive value
Console.WriteLine(s.IndexOf("ear", pos + 1));
// A second optional argument may be passed
// as a starting offset where the search shall begin