It’s also why I told Allan to be careful using Lexicographical (“Dictionary Order”) sorting.
“azzzzzzzzz” < “ba” is true, because the thing looks at the first letter, sees “a” comes before “b” in the dictionary, and sorts it that way. It doesnt need to look at any of the other letters - once it’s found a difference, it can make a decision and stop.
Lets take some points + name combinations, as was suggested.
“100Macy” and “100Mark”, would sort correctly, because it would compare “letter” by letter -
“1” = “1”, keep going.
“0” = “0”, keep going.
“0” = “0”, keep going.
“M” = “M”, keep going.
“a” = “a”, keep going.
“c” != “r”, stop; I can determine that “100Macy” goes first based on this difference, i don’t need to check any further. So this sorts correctly.
“120Macy” and “140Amy”, would not sort correctly, because it would compare “letter” by letter -
“1” = “1”, keep going;
“2” != “4”, stop. I can determine that “120Macy” goes first based on this difference (Note that this is actually backwards; you want the lower number to go SECOND, not first.)
But even if the order wasnt backwards, there are deeper problems.
The big problem comes when you start using this comparisson on string-numbers of different magnitudes.
“1000Jim” vs “30Mark” - based on character-by-character sorting, the system will think that 1000Jim comes first - even though Jim’s point total was 1000, and Mark’s was 30, the comparison doesn’t zero-pad the smaller number, so things dont go right.
This is why you often see things like:
1
10
11
12
13
2
…
8
9
- the system is doing a Lexicographical sort, and is treating the numbers as strings.