c-sharp

C# Program to check whether a string contains a substring

The program can be used to check whether a string contains a sub-string or not using C#.

using System;
  
class StringChecker {
    // Main Method
    public static void Main()
    {
        String str = "Devsheet";
        String subStr = "sheet";

        Console.WriteLine(str.Contains(subStr));
        // -> true
    }
}
Was this helpful?