Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbers followed by a letter are sorted differently if they start with zero #8

Open
DeannaV opened this issue Nov 5, 2019 · 0 comments

Comments

@DeannaV
Copy link

DeannaV commented Nov 5, 2019

['02', '04', '15', '22', '099', '02B', '04B', '15B', '22B', '099B'].sort(natsort());

I expected the result to be ["02", "02B", "04", "04B", "15", "15B", "22", "22B", "099", "099B"]

The actual result was ["02B", "02", "04B", "04", "15", "15B", "22", "22B", "099B", "099"]

For numbers starting with zero, the numbers with B are sorted first. I expected that the numbers followed by a letter would always be after the number by itself.

Is this a bug or is it intended to be this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant