We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a363f67 commit 48725a7Copy full SHA for 48725a7
src/Models/NumericSort.cs
@@ -50,22 +50,9 @@ public static int Compare(string s1, string s2)
50
string sub2 = new string(tmp2, 0, loc2);
51
int result;
52
if (isDigit1 && isDigit2)
53
- {
54
- // compare numeric values
55
- if (sub1.Length == sub2.Length)
56
57
- // if length is the same, lexicographical comparison is good also for numbers
58
- result = string.CompareOrdinal(sub1, sub2);
59
- }
60
- else
61
62
- result = sub1.Length.CompareTo(sub2.Length);
63
64
+ result = loc1 == loc2 ? string.CompareOrdinal(sub1, sub2) : loc1 - loc2;
65
else
66
67
- result = string.Compare(sub1, sub2, System.StringComparison.Ordinal);
68
+ result = string.CompareOrdinal(sub1, sub2);
69
70
if (result != 0)
71
return result;
0 commit comments