diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-12-13 17:34:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-13 10:34:41 +0100 |
commit | 7e1ea50bc3a495bc8feb69ceb9856a0a28ecc2e9 (patch) | |
tree | 82bb42ecfb9877a568578597a1823eec4bcb7650 /lib/std | |
parent | e51e98997ba0aae748ff51eea8133e83370a7df5 (diff) | |
download | Nim-7e1ea50bc3a495bc8feb69ceb9856a0a28ecc2e9.tar.gz |
fixes #23060; `editDistance` wrongly compare the length of rune strings (#23062)
fixes #23060
Diffstat (limited to 'lib/std')
-rw-r--r-- | lib/std/editdistance.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/editdistance.nim b/lib/std/editdistance.nim index 6a25ca4b9..40c0017ae 100644 --- a/lib/std/editdistance.nim +++ b/lib/std/editdistance.nim @@ -18,7 +18,7 @@ proc editDistance*(a, b: string): int {.noSideEffect.} = ## This uses the `Levenshtein`:idx: distance algorithm with only a linear ## memory overhead. runnableExamples: static: doAssert editdistance("Kitten", "Bitten") == 1 - if len(a) > len(b): + if runeLen(a) > runeLen(b): # make `b` the longer string return editDistance(b, a) # strip common prefix |