Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: nesting issue



On Sun, May 5, 2024 at 6:51 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> Man ... I dunno, maybe the world needs different sorting logic between Canada and the US but to me it just looks like making trouble.

C sort is done in the order of the ASCII values of the characters.
Locale-based sorting is intended to match (hardcopy) dictionary order
for the represented language.  The latter may mean that "A" and "a"
both sort before "B" and "b" and so on, whereas ASCII sorts all
uppercase letters before all lowercase.  Handling of numbers and
punctuation relative to letters and numbers may also vary.

Sorting usually proceeds left to right by character position, which
means e.g. "22" sorts before "4" because ASCII "2" (062) is compared
to "4" (064).  When you ask for "numeric" sorting, each consecutive
series of digits is instead interpreted as an integer that occupies
one "position" -- but the strings are still compared position by
position, so when comparing "a2" to "10b" the character "a" is
compared to the integer "10" and sorts after it.  You only get actual
numeric ordering for "mixed" alphanumerics when the numbers occupy the
same relative positions.

Version sorting is yet another thing entirely, see
Functions/Misc/is-at-least for example.




Messages sorted by: Reverse Date, Date, Thread, Author