Closed antonioborondo closed 5 years ago
Hi Antonio,
Thanks for opening an issue here.
The library doesn't claim to match 1:1 the behavior of Windows Explorer, so it's expected that there might be some differences. However, I also think that the first ordering as done by Windows Explorer might be a better result and more expected. So it might be good to alter the behavior a bit.
I'll try to check this out to see how my algorithm can be tweaked when I find some free time some day.
If you want to make a PR yourself, feel free to do so, the entire source code is very small: https://github.com/tompazourek/NaturalSort.Extension/blob/master/src/NaturalSort.Extension/StringComparerNaturalSortExtension.cs
I have rewritten the sorting algorithm so that it would work a bit differently.
I released the changes as version 2.0.0, it should be available on NuGet any moment now (once their validation and indexing finishes).
Your example is now one of the test cases: https://github.com/tompazourek/NaturalSort.Extension/blob/master/tests/NaturalSort.Extension.Tests/NaturalSortComparerTests.cs#L32-L33
Closing this. Thanks!
Hi Tom, I just updated my app (https://github.com/antonioborondo/batch_file_renamer) to use the new version of your library and it works perfect. Thank you so much!
@antonioborondo Great, I'm glad to have helped!
The following list of files ordered by name in Windows explorer:
Are sorted differently with NaturalSort.Extension:
Tested with NaturalSort.Extension v1.0.2 via NuGet.