|
Rockbox mail archiveSubject: 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: Al Le <al.le_at_gmx.de>
Date: Wed, 18 Mar 2009 23:38:57 +0100 On 18.03.2009 23:20, Thomas Martitz wrote: > Right. We cannot surely predict whether it is intentional or accidental. Here I'm with you > Which is why we decided to go with the original implementation and say > "the author of the code made it like that". 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. > And, we can only special case very leading zeros. They wouldn't have to be treated specially, since the rule is general enough to handle them. > Going back to what was before yesterday Again: the idea is primary (and stable), the implementation is secondary Received on 2009-03-18 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |