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: Paul Louden <>
Date: Thu, 19 Mar 2009 18:22:53 -0500

Al Le wrote:
> Paul, I think we can agree that there are different cases. There are
> cases where a leading zero is intentional and there are cases where
> it's just there (because you used a wrong setting in the ripping
> software or because you copied the file from somewhere else). The
> problem is that a single "natural" sort won't fit all. Maybe we should
> have two natural sort procedures? One would ignore the leading zeroes,
> i.e. just consider numbers as in mathematics (it would put "007" after
> "6") and the other wouldn't (it would put "007" before "6").
Neither of your described cases would result in a mix of leading zeros
and no leading zeros though. If you set the wrong setting, all your
files would have leading zeros and still sort fine. So what's the problem?

This is what I don't get - nobody's described a real case where
acknowledging leading zeros causes a *bad* sort except the one "mix
folder" case where the user chooses to rename some, but not all, of his
Received on 2009-03-20

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