Categories
.net

Comparing strings

Comparing two strings is easy and simple, right? Wrong. Check out this article which deals with string comparison in .net 2.0. As an exercise guess the output of this piece of code:

Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR"); Console.WriteLine("Culture = {0}", Thread.CurrentThread.CurrentCulture.DisplayName); Console.WriteLine("(file == FILE) = {0}", (String.Compare("file", "FILE", true) == 0));

True or false, that’s the question.

2 replies on “Comparing strings”

Leave a Reply