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