CSharp examples for Language Basics:string
Specifying a 'culture' in string comparison
using System;/*w w w .j a v a 2 s. c o m*/ using System.Text; // Need for type UTF8Encoding. using System.Globalization; // Need for cultures. class Program { static void Main(string[] args) { string line = "SOME STUFF"; if (string.Compare(line.ToUpper(CultureInfo.InvariantCulture), line, false) == 0) Console.WriteLine("yes 1"); if (string.Compare(line, "line", StringComparison.InvariantCultureIgnoreCase) == 0) Console.WriteLine("yes 2"); } }