Maha

Maha

  • NA
  • 0
  • 324k

StringComparison

Oct 7 2013 10:32 AM
This program is given in the following website.
http://www.dotnetperls.com/stringcomparison

What is the meaning of the "CurrentCulture" and "InvariantCulture" . Problem is highlighted.

using System;

class Program
{
static void Main()
{
//
// Use the StringComparison enumerated type on the string input.
// ... The *IgnoreCase constants can be used with a lowercase parameter.
// ... Uppercase or mixed-case is fine too.
//
const string input = "Dot Net Perls";
Console.WriteLine(input.IndexOf("Net", StringComparison.Ordinal));
Console.WriteLine(input.IndexOf("net", StringComparison.OrdinalIgnoreCase));
Console.WriteLine(input.IndexOf("Net", StringComparison.CurrentCulture));
Console.WriteLine(input.IndexOf("net", StringComparison.CurrentCultureIgnoreCase));
Console.WriteLine(input.IndexOf("Net", StringComparison.InvariantCulture));
Console.WriteLine(input.IndexOf("net", StringComparison.InvariantCultureIgnoreCase));
}
}


Answers (3)