diff options
author | Charles Blake <cblake@csail.mit.edu> | 2015-11-19 06:52:31 -0500 |
---|---|---|
committer | Charles Blake <cblake@csail.mit.edu> | 2015-11-19 06:52:31 -0500 |
commit | 716c12a4365c04fcd164c8e1295805b3311cd517 (patch) | |
tree | 6b59d55ceee476a2569ccdabc4347f494c3492cb | |
parent | ba6d0eb4db5bb85c772dea3d4c5afb2bfbb5a6d5 (diff) | |
download | Nim-716c12a4365c04fcd164c8e1295805b3311cd517.tar.gz |
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
-rw-r--r-- | lib/pure/strutils.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index b61df6086..6c561eaf9 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -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 |