To check if string starts with specific word
To check if a string starts with some specific word(s) we use StartsWith method. Return type of this method is Boolean.
stringFruit = "Apple";
if (Fruit.StartsWith("A"))
{
Console.WriteLine("Fruit starts with A");
}
Output
Fruit starts with A
Comments
Post a Comment