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: Thomas Martitz <>
Date: Thu, 19 Mar 2009 15:02:17 +0100

Mike Holden wrote:
> Maybe leading zeros should only be stripped if another digit follows them?
> I use names like 00RockFaves.m3u, 00ClassicRock.m3u for playlists that I
> have created (as opposed to original artist albums), and the leading
> zerozero is deliberately there to sort them at the top.
> At the moment using natural sorting, 00RockFaves.m3u is sorted among the
> "R" entries, totally defeating my intention in choosing that naming (and
> not "natural" to my view!).
> 01Rock should sort before 02Rock, agreed, but should 01Rock sort before A
> or before S?

Sounds to me that you're better off using ascii sort.
>> In any case, it would be interesting to see how windows does the
>> sorting, as the most users will be used to that way of doing it.
> Maybe many, but we shouldn't assume that is the case. I personally have no
> idea how Windows does it, and I wouldn't necessarily agree that just
> because MS does it that that is the _right_ way to do it.

Windows does it in the same way as nautilus and other major file
browsers. It ignores leading zeros.
Received on 2009-03-19

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