dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: how is strnatcmp aka "Interpret numbers while sorting" supposed to sort?

Re: how is strnatcmp aka "Interpret numbers while sorting" supposed to sort?

From: Marianne Arnold <>
Date: Fri, 20 Mar 2009 01:21:42 +0100

Thomas Martitz wrote:

> Alternatively we can also think about ignoring chars like . and _ (and
> possibly more) in the beginning of a file name (e.g. .rockbox is sorted
> under r). Just an idea. It doesn't really add complexity, but would
> definitely do more than the setting advertises. But, this is also
> something windows/nautilus/more do.

Huh? Windows Explorer at least *does not* ignore "_" and does not sort "_something" among the "s" but puts it at the top before "a", even before numbers. The ".rockbox" folder is also sorted above the "Music" folder in my "simdisk" directory...

It also respects number of spaces and *does not* collapse it to one. Resulting order in a small test:
! Test
! A
If it would ignore the second space it would sort "! Test" last.

In reply to an earlier mail here, I am one who occasionally (ab)uses this function of sorting to put temporary data at the top, somwhere outside the rest of the list. This is not specific to Rockbox because I don't use it for my music collection but for other files on my computer. I like the described way for file/directory names starting with special characters and think they should be treated like this in Rockbox, too (as they are currently?). And as you said yourself, adding this will do more than "advertised"; the same thing applies to spaces as well (as Dominik pointed out), so the setting either has a wrong name or should be fixed in this regard.

My preference would also be to treat leading zeros as intentional, just looking at a list in explorer, "01, 02, 3, 04" seemed weird to me - guess it's the same effect Paul described and reported about his friends. About the mathematical rule: that's true without a doubt but if I read "04 + 03 = 07", I would suspect some weird reasoning behind (something intentional that I only don't know about). One just doesn't write a leading zero if (s)he doesn't have to.

To summarise: first a strong wish that more than one space is treated as such and no ignoring of even more "special" chars - also to comply with the setting name. Perhaps don't ignore leading zeros, although I could understand the reason "all major file browsers do, so should we"; so far I found Paul's example in favour of not ignoring them more realistic though.

Regards, Marianne.
Received on 2009-03-20

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy