Cosmic Q&A
How can I check of a string contains a substring in C#?
Answer
We can check if a string contains a substring using Contains method.
string word = "XMarksTheSpot";
// Check if words contains the substring
Console.WriteLine(word.Contains("The"));
Share this page:
Report Error in Content