From 716c12a4365c04fcd164c8e1295805b3311cd517 Mon Sep 17 00:00:00 2001 From: Charles Blake Date: Thu, 19 Nov 2015 06:52:31 -0500 Subject: 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 --- lib/pure/strutils.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit 1.4.1-2-gfad0