Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



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: Mike Holden <rockbox_at_mikeholden.org>
Date: Thu, 19 Mar 2009 12:54:39 -0000 (UTC)

Dominik Riebeling wrote:
> well, treating a number as such includes stripping leading zeros from
> it, at least from my understanding. It won't do any harm on properly
> named files, and I don't see a reason why a user would want to prefix
> with 0 just to change sorting.

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?

> 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.

-- 
Mike Holden
http://www.by-ang.com - the place to shop for all manner of hand crafted
items, including Jewellery, Greetings Cards and Gifts
Received on 2009-03-19

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