Skip to content

Commit 2a88758

Browse files
committed
sorting fix if name ends with whitespace
1 parent 60a6c1e commit 2a88758

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ARKBreedingStats/utils/NaturalComparer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ int IComparer<string>.Compare(string aStr, string bStr)
2121

2222
while (true)
2323
{
24-
// Handle when we hit the end of either string
25-
if (aI >= aLen && bI >= bLen) return 0;
26-
if (aI >= aLen) return -1; // The shorter string sorts first
27-
if (bI >= bLen) return 1;
28-
2924
// Skip spaces on both sides, if requested
3025
if (SkipSpaces)
3126
{
3227
aI += SkipWhiteSpace(aStr, aI);
3328
bI += SkipWhiteSpace(bStr, bI);
3429
}
3530

31+
// Handle when we hit the end of either string
32+
if (aI >= aLen && bI >= bLen) return 0;
33+
if (aI >= aLen) return -1; // The shorter string sorts first
34+
if (bI >= bLen) return 1;
35+
3636
// Pick up the next character from each string
3737
char a = aStr[aI];
3838
char b = bStr[bI];

0 commit comments

Comments
 (0)