c# search a string for a substring code example
Example 1: c sharp index of substring
string str = "Hello World!"
str.IndexOf("o");
str.IndexOf("o", 6, 4);
str.LastIndexOf("o");
Example 2: how to look for substring in string in c#
String phrase = "this is the ultimate string";
Console.WriteLine(phrase.Contains("this"));
Console.WriteLine(phrase.Contains("python"));
Example 3: c# find substring in string
string fullName = "John Doe";
bool nameInFullName = fullName.Contains("John");
Example 4: search letters in list c#
Total number of words in the string is : 3