natsort icon indicating copy to clipboard operation
natsort copied to clipboard

Comparisons incorrect on leading zeros

Open david-a-wheeler opened this issue 2 years ago • 0 comments

The comment says:

The longest run of digits wins. That aside, the greatest value wins, but we can't know that it will until we've scanned both numbers to know that they have the same magnitude, so we remember it in BIAS.

It should be the "longest run of digits ignoring leading zeros wins". E.g., given:

5
8
007

It should sort as 5, 007, 8 and not as 5, 8, 007.

Please note that I'm responding just based on a quick look at the source code.

david-a-wheeler avatar Aug 11 '23 17:08 david-a-wheeler