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

Popular posts from this blog

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net