-
Notifications
You must be signed in to change notification settings - Fork 3
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
New sorting is still strange #16
Comments
This is tracking issue rlwhitcomb/utilities#547. |
I had a look and the problem is that "0" is kind of special since it there can be leading zeroes. The method isSpaceOrSeparatorOrEmpty could be adjusted like this: The example with the one character strings is very basic and this library is not intended for this purpose. Do you have longer examples which illustrate this issue? |
The original reason this came up was in my Calculator language I define special variables for function parameters (for the case of variable number of arguments) named "$#" (for total number of args), "$*" (for the array of arguments), plus "$0", "$1, "$2", etc. for each individual argument. I was trying to sort them and saw the strange order, so basically any prefix to these "#", "*" would cause it. I don't know how common this type of naming would be, but ...
My thought to fix it was to basically sort symbols in their ASCII order compared to numbers, so the test you mentioned could just be `... || c < '0' (Note: I haven't tried that yet to be sure). |
Further testing just now shows this weirdness too:
where the "0" gets put to the end ... |
I can't get it to work for everything. |
That solution sounds like probably the only way to get it to "work", but I'm afraid for my use case it probably won't fly, because in order to set the "right" sort flavor I'd have to analyze the data beforehand, which isn't feasible.... Unfortunately. |
It seems similar to this: paour/natorder#14 |
Even with "natorder-1.1.3.jar":
I would expect [ "#", "$", "0", "1", "2" ] instead
The text was updated successfully, but these errors were encountered: