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?
On 18.03.2009 23:44, Paul Louden wrote:
> Al Le wrote:
>> To that simple rule (treating a sequence of numbers as a number) I'd
>> probably add the rule that many subsequent spaces are folded to one.
>> E.g. "A space space B" would be equal to "A space B" modulo natsort.
>> strcmp would be used to resolve the case.
> This seems another arbitrary "I think it should be done this way"
> addition. I thought you wanted a simple rule?
I agree here. It's a bit arbitrary but would fit the "natural". But I
wouldn't insist on it since the setting is only about numbers.
> How about "Don't require leading zeros." Described as "Numbers after
> leading zeros will be interpreted as whole numbers, rather than a series
> of digits." A simple rule, and one that lest people know that zeros in
> the middle of strings won't randomly be ignored (which they will be in
> currently proposed systems).
> It's a simple rule, can be described in on sentence, includes an option
> name that's descriptive, and doesn't ignore user provided parts of the
Yes, it's a simple rule, and from this point of view I could very well
live with it. But it puts "04" before "3" which wasn't the intention of
the natsort in the beginning (if I understand correctly). For example,
Nautilus puts "03" before "4".
Received on 2009-03-18
Page was last modified "Jan 10 2012" The Rockbox Crew