Skip to content

Instantly share code, notes, and snippets.

@airbreather
Last active August 29, 2015 14:27
Show Gist options
  • Save airbreather/237c93c82f43b4018fbc to your computer and use it in GitHub Desktop.
Save airbreather/237c93c82f43b4018fbc to your computer and use it in GitHub Desktop.
Crazy Case Comparisons
using System;
using System.Globalization;
using System.Threading;
namespace ConsoleApplication1
{
internal static class Program
{
private static void Main()
{
const string FirstString = "\u00e9\u0131\u0065\u0308\u0130\u004f\u0304\u0328";
const string SecondString = "\u0045\u0301\u0049\u00eb\u0069\u01ed";
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("tr-TR");
// true
Console.WriteLine(String.Equals(FirstString, SecondString, StringComparison.CurrentCultureIgnoreCase));
// false
Console.WriteLine(String.Equals(FirstString, SecondString, StringComparison.CurrentCulture));
// false
Console.WriteLine(String.Equals(FirstString, SecondString, StringComparison.InvariantCultureIgnoreCase));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment