if I type this into my Immediate Window
String.Compare("AA", "SA");
I get a result of 1
surely this is wrong? AA is less than SA so shouldn’t it be -1?
I am running .NET 4
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the Danish culture “AA” is treated as a single letter “Å” and alphabetically it comes after “Z”.
Result:
To get the result you want you can use invariant culture (or a specific culture that has the sort order that you desire):
Result: