[...]
"a-".CompareTo("a0") = -1
"a-0".CompareTo("a0") = 1
I think this looks broken to anyone who has ever done traditional data
processing just about anywhere.
No doubt. But those people are traditionally poorly-equipped to implement
culturally localized program behavior without further training (being one
of those people, I feel confident in that statement...it's required quite
an adjustment for me to abandon many of the ideas I learned 30+ years ago
as computer systems have become more and more complex and supporting
non-English environments has become more and more important).
The rule you expect is that strings of unequal length are compared for
the shorter length and if that result is unequal then you are done,
otherwise the longer string sorts higher. No character gets special
handling as the comparison is bitwise binary.
Microsoft is free to redefine alphanumeric sorting of course. But this
is a particularly ugly example of why IBM had it right in the first
place, IMO.
As character sets get broader and broader, it is simply not possible for a
numeric character code to be the sole determining factor in sorting and
still achieve results that appear culturally normal to users.
And once the comparison method has to take that into account, it makes
sense to apply the culturally-sensitive logic to _all_ cultures, not just
the newly-supported ones.
In the olden days, we only had to deal with ASCII, and users were
accustomed to computers doing things "the computer way" instead of "the
user's way". But, that's not the world we live in now.
All that said, anyone who adamantly feels this is really a problem is free
to file a bug report on Microsoft's Connect web site, or to vote for an
existing bug report. I've already posted references that explain the
"why" of this behavior. Continuing to debate here about how much you hate
the behavior doesn't accomplish anything, except perhaps to create a
ruckus. If you actually care about it, do something that has some chance
of having some positive outcome. Just whining about it isn't useful.
Pete