Skip to content

Commit

Permalink
Fix sort order for cmp(string)
Browse files Browse the repository at this point in the history
It is still system-dependent, but shorter strings should come sooner.

See nim-lang#8930 and nim-lang#10559
  • Loading branch information
Christopher Dunn committed Sep 2, 2019
1 parent 545ddf4 commit ab4721f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/system.nim
Expand Up @@ -3641,7 +3641,7 @@ when not defined(JS): #and not defined(nimscript):
let minlen = min(x.len, y.len)
result = int(nimCmpMem(x.cstring, y.cstring, minlen.csize))
if result == 0:
result = x.len - y.len
result = y.len - x.len

when declared(newSeq):
proc cstringArrayToSeq*(a: cstringArray, len: Natural): seq[string] =
Expand Down

0 comments on commit ab4721f

Please sign in to comment.