7 February 2014

Ignore the case while comparing two strings in C#



Below is the best way to compare the string in C# and ignore the case sensitive.

string strCompare = "ADIdotnet";

if (strCompare.Equals("adidotnet", StringComparison.InvariantCultureIgnoreCase))
{
/// it is true
}

No comments:

Post a Comment