How do I check if string ends with a specific text?
Category: System, viewed: 2K time(s).
An example to check if a string ends with a specific text.
using System;
namespace Kodecsharp.Example.System
{
public class EndWith
{
public static void Main(string[] args) {
string text = "The quick brown fox jumps over the lazy dog";
string str = "lazy dog";
if (text.EndsWith(str))
{
Console.WriteLine("Text ends with " + str);
}
Console.ReadLine();
}
}
}