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?
Al Le wrote:
> But here not anymore. I think the verbal description should be first,
> and then the implementation of it. You say "we take an implementation
> (as the author did it) and try to describe it". I say "we define a
> simple rule (but which sorts the names as users expect it) and
> implement it. If the original algorithm would have to be modified then
> we modify it".
> 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?
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
Received on 2009-03-18
Page was last modified "Jan 10 2012" The Rockbox Crew