@peterdrake Sorting by ASCII order would be terrible anyway because then upper and lower cases of the same letter would end up in totally different sections in the results. Any competent alphabetic search would split and sort between letters, numbers, and punctuation first.
Also, I have not heard of using the underscore that way. That sounds like a sign that you need to refactor instead of hacking stuff in. I always name things based on their form/function. If I prefix it with anything, it's the type (i.e. "MatSteel")
@peterdrake @andykorth Maybe I've just gotten used to the .NET/Windows way.
Here's some more info about how it works behind the scenes: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.compareoptions?view=net-7.0
@LouisIngenthron @peterdrake Oh nice find, that's a much better document than I found!
@LouisIngenthron @andykorth Thanks.
I can't imagine how I would have ever found that page, even if I was looking for it.
@peterdrake @andykorth I went to the String.CompareTo page first, and it led me there.
@peterdrake @LouisIngenthron
You can find information about it by looking for "sort collations". Unicode does define one (the Unicode Collation Algorithm)
I think C# matches the SQL stuff microsoft provides here, but I'm not sure:
https://learn.microsoft.com/en-us/ef/core/miscellaneous/collations-and-case-sensitivity#database-specific-information
A lot of it is, understandably, complicated by different locales. (where does á sort vs. a?)
@LouisIngenthron @andykorth
"Sorting by ASCII order would be terrible anyway because then upper and lower cases of the same letter would end up in totally different sections in the results. Any competent alphabetic search would split and sort between letters, numbers, and punctuation first."
I disagree. In theory, all items in a given directory would be capitalized the same way, so this shouldn't matter, right?
More importantly, everybody else does it by ASCII. For example, Python:
sorted(["_b", "B", "a", "_a", "c", "C", "_"])
['B', 'C', '_', '_a', '_b', 'a', 'c']
For the problem I'm running into, apparently Pixel Crushers' Dialogue System sorts the quests by ASCII, not the Unity/C# way. When I wanted certain quests to show up first, I put underscores at the beginnings of those quests behind-the-scenes names. I had assumed incorrectly (based on the aforementioned behavior) that the underscore came before letters. Now I have to repeat that extensive surgery.
"I have not heard of using the underscore that way."
I believe Bond uses it in his (excellent) book. Also, for example:
https://forum.unity.com/threads/editor-project-window-tab-sorting.67916/#post-434218
Finally, I can't find where this surprising sorting behavior is documented, either for Unity or C#.
Descriptive subject title but... Is there any way to change the sorting order for the Project tab in the editor? Currently its purely...
forum.unity.com