Gwyn wrote:
If I test "A+" > "A-" then I get true
If I test "A+A" > "A-A" then I get false
What the hell is going on?! I can only imagine it's down to culture... but
why? my thread culture setting is "en-GB"
What rules are going on here? Does this mean the only way I can ever test
strings is to use String.CompareOrdinal ??????
I suspect it's viewing '-' as a character which can join two words
together, but '+' as just whitespace, so
foo+bar > foo-bar > foobar
Just a guess though - I don't have my laptop at the moment and can't
check.
As for how you should test strings - it entirely depends on the
context. If you want to compare them in a culture-sensitive way, then
expect results like the above. If you want to sort them in a
culture-insensitive way, use String.CompareOrdinal.
See
http://msdn.microsoft.com/library/de...ngsinNET20.asp
for more on this.
Jon