Welcome to RightHand's community place Sign in | | Help

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.

Published 1. junij 2007 10:49 by Miha Markic
Filed under:

Comments

# re: Comparing strings

1. junij 2007 17:37 by Milan Negovan
If it's Turkish, it's false. :)

# re: Comparing strings

2. junij 2007 14:51 by Miha Markic

Indeed.

Anonymous comments are disabled