We can use Contains method from string to search a substring.
using System;
class Sample
{
public static void Main()
{
string s = "rntsoft.com";
Console.WriteLine(s.Contains("java"));
}
}
The output:
True
In the same way we can use StartWith, EndWith methods.
using System;
class Sample
{
public static void Main()
{
string s = "rntsoft.com";
Console.WriteLine(s.StartsWith("java"));
Console.WriteLine(s.EndsWith("java"));
}
}
The output:
True
False