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: Wed, 18 Mar 2009 17:37:51 -0500

Dominik Riebeling wrote:
> Just consider this scenario: someone is creating a mix folder by
> copying various files to it. He wants a given order. Now some files
> are named with 0 prefixes, others not. He decides to not use 0
> prefixes, possibly because of laziness, but leaves them on the files
> he doesn't need to change at all -- if "05" is to become track 5 he
> doesn't need to change anything. As for track "09" which should become
> 3 he'd use "3". Too far-fetched?
So he numbers the mix manually for most of the songs, but in the case of
some songs that are already the right track number, he doesn't renumber
them? This seems like a rather special case to justify throwing out user
> well, treating a number as such includes stripping leading zeros from
> it, at least from my understanding.
Where in my example did leading zeros show up that require stripping, then?

> 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.
Because I expect to see the folder "007 - James Bond" before the folder
"5th Element" even if I have natural sorting on for my tracks, among
other things. It's not "7 - James Bond" it's "Double Oh 7". They're
significant numbers, intentional and not accidental.
Received on 2009-03-18

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