Not behaving the same behavior as Windows Explorer for "X", "X-1", "X-2",...
Hi Tom,
Glad having found your extension for completing a test case for my own open source project https://sourceforge.net/p/y-a-terminal/ I unfortunately ran into an issue or limitation:
Windows Explorer behavior
NaturalSort behavior
Is this something that could be refined in NaturalSort?
Note that Windows Explorer has the shown behavior also on @, ', –, _, ¦, [, ] but not on (, ), , ., !, $ nor #. Unfortunately, havent't found a Microsoft resource where the behavior is specified in full detail. However, haven't either found a specification which characters are handled by NaturalSort.
Best regards, Matthias
Note the ["X", "X-1", "X-2"] (as in the title) seems to be correctly sorted.
It's different once you add the .: ["X.log", "X-1.log", "X-2.log"]. So it's about . vs -, in my opinion.
I suspect it's due to Windows sorting the non-alphanumerical characters in some special way (my machine):
NaturalSort uses this for CurrentCulture:
a_a
a-a
a,a
a;a
a!a
a.a
a'a
a(a
a)a
a[a
a]a
a{a
a}a
a@a
a&a
a#a
a%a
a`a
a^a
a+a
a=a
a~a
a$a
And this for Ordinal:
a!a
a#a
a$a
a%a
a&a
a'a
a(a
a)a
a+a
a,a
a-a
a.a
a;a
a=a
a@a
a[a
a]a
a^a
a_a
a`a
a{a
a}a
a~a
So it seems to be culture specific somehow.
There is this test that used to ensure it's aligned with Windows Explorer:
https://github.com/tompazourek/NaturalSort.Extension/blob/master/tests/NaturalSort.Extension.Tests/NaturalSortComparerTests.cs#L57-L58
But maybe the situation or the sorting changed somehow since? I guess it's possible the test data was invalid.
I don't have a clear idea on how to resolve this, it needs more research.
I have now isolated these problematic characters (between two x) that might behave differently to Windows Explorer:
x'x
x+x
x-x
x=x
x`x
I don't know yet how to adjust the sorting algorithm though...