OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

office message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [office] Proposal for Spreadsheets: New sort option "naturalsort"

Martin Pool:
> > If I'm reading this correctly, that means that "1.3" > "1.20", in a
> > locale where "." is the decimal separator.  In typical software version
> > strings that's not correct, and that was the case I was originally
> > trying to handle, and also apparently the case Robert Weir describes.
> > Obviously sometimes sorting as floats is best but I suggest that when
> > numbers are intermixed with non-digits the other algorithm is better.
> > That is, to basically follow this algorithm but just treat the decimal
> > separator as non-numeric.

Michael Brauer:
> I think we have some kind of conflicting requirements here: You either 
> want to be able to sort floating point numbers. You then need to 
> interpret the decimal delimiter. Or you want to be able to sort version 
> numbers. You then must not interpret the decimal delimiter.
> What about resolving this conflict by having two options (or three, if 
> the include the default character code based sorting) instead of one, 
> "natural-integer" and "natural-float", where the first one sorts only 
> integer values, while the 2nd one sorts floats?

In all the "Natural sort" algorithms I've seen, the data is expected to include
trailing digits after a decimal point. So "1.30" > "1.20".

If you truly want a "version sort", that's a different animal.  Perl, for example, includes separate routines for doing version sorts that are DIFFERENT from its natural sort implementation.

If you're doing something significantly different than the usual "natural sort", it should have a new name.

If we ARE going to include a "natural sort", is Michael's proposed definition the same as used elsewhere?

--- David A. Wheeler

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]