Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
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: Al Le <al.le_at_gmx.de>
Date: Wed, 18 Mar 2009 23:28:08 +0100

On 18.03.2009 23:12, Paul Louden wrote:
>> I'd rather have an "absolute" than a "relative" definition.
> We already have an absolute: ASCII sort.

Yes, but it doesn't treat the case "1, 2, ..., 10" in the way many users
would expect (ot like) it. Hence the natsort.

> Our "natural" sorting is entirely a mishmash of rules as to how numbers
> should be treated, and other characters.

It wouldn't be such a mishmash if we'd implement just that simple rule
(which is given a very well name): "interpret numbers as ...". Any
non-digit character (also a dot and a comma) are just characters, i.e.
we only consider integer numbers.

> For example, is "1.001" one point zero zero one,

Not in natsort

> or disk one track one,

Not this in natsort. In natsort it would be "the number 1", a dot, "the
number 1". The interpretation of the numbers is beyond the scope.

> or one thousand and one?

No since it assume a country specific separator.

> If we make up our own non-standard way, yes, we can describe it. We can
> a few paragraphs in the manual detailing how people can expect their
> files to be sorted, since no other program does it like we do.

Actually we wouldn't need a very long description if the rule would be
simple enough.

> I don't see why "we can describe it" is a reason to use our own method -
> we can describe methods we get the code for from elsewhere too.

But, as you pointed out above, such a complicated logic requires a long
description with many examples illustrating all the quirks. Which makes
such a description pointless since nobody would grasp it.
Received on 2009-03-18


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa