I faced with a problem that string comparison in C# works a bit strange:
"0".CompareTo("@") // is 1
And I'm very surprised with that because ASCII codes is next:
ASCII '@' // 64
ASCII '0' // 48
If I'm comparing chats or use String.CompareOrdinal everything fine:
'0'>'@' // false
String.CompareOrdinal("0","@") // -16
And in JS it works also as expected:
"0" > "@" // false - in Javascript
Next thing that C# code I can't change - it uses CompareTo.
But I need same sorting rules in Javascript. I can't find any solution smarter than replace '@' sign with the '#' because it ASCII code less than zero:
ASCII '#' // 35
Maybe somebody can explain why:
"0".CompareTo("@") // is 1
Or suggest better workaround how making comparison the same in Javascript