To check if string ends with specific word(s)

To check if a string ends with specific word(s) we use EndsWith method. Return type of this method is Boolean.

stringFruit = "Apple";
if (Fruit.EndsWith("e",StringComparison.OrdinalIgnoreCase))
{
    Console.WriteLine("Fruit ends with e");
}

Output


Fruit ends with e

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