C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String IndexOf()The C# IndexOf() is used to get index of the specified character present in the string. It returns index as an integer value. Signaturepublic int IndexOf(Char ch) public int IndexOf(Char, Int32) public int IndexOf(Char, Int32, Int32) public int IndexOf(String) public int IndexOf(String, Int32) public int IndexOf(String, Int32, Int32) public int IndexOf(String, Int32, Int32, StringComparision) public int IndexOf(String, Int32, StringComparision) public int IndexOf(String, StringComparision) Parametersch: it is a character type parameter. ReturnIt returns an integer value. C# String IndexOf() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello C#"; int index = s1.IndexOf('e'); Console.WriteLine(index); } } Output: 1
Next TopicC# String Insert()
|