mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Fix loop index bug in scan for a[s] in b[s..s+len2-1].
a, b must both be indexed starting from s after the common prefix "strip" phase. This resolves issue 3477: https://github.com/nim-lang/Nim/issues/3477
This commit is contained in:
@@ -1281,7 +1281,7 @@ proc editDistance*(a, b: string): int {.noSideEffect,
|
||||
|
||||
# another special case:
|
||||
if len1 == 1:
|
||||
for j in s..len2-1:
|
||||
for j in s..s+len2-1:
|
||||
if a[s] == b[j]: return len2 - 1
|
||||
return len2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user