diff options
author | Araq <rumpf_a@web.de> | 2011-09-26 00:24:06 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-09-26 00:24:06 +0200 |
commit | 14968fba46a0c1128f38859b339c7384f9f96cd4 (patch) | |
tree | 5fcd6a68f54c4df629ae0545f34e974b2a8f5907 /lib/pure/strutils.nim | |
parent | 0f37d0e1f2aeee466b3c6179886963354eaa6222 (diff) | |
download | Nim-14968fba46a0c1128f38859b339c7384f9f96cd4.tar.gz |
bugfix: internal error in evalFieldAccess; parseutils.interpolatedFragments optimized; tstringinterp.nim now works
Diffstat (limited to 'lib/pure/strutils.nim')
-rwxr-xr-x | lib/pure/strutils.nim | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 9f7e01693..53aa34c83 100755 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -640,8 +640,7 @@ proc join*(a: openArray[string], sep: string): string {. if len(a) > 0: var L = sep.len * (a.len-1) for i in 0..high(a): inc(L, a[i].len) - result = newString(L) - setLen(result, 0) + result = newStringOfCap(L) add(result, a[0]) for i in 1..high(a): add(result, sep) @@ -655,8 +654,7 @@ proc join*(a: openArray[string]): string {. if len(a) > 0: var L = 0 for i in 0..high(a): inc(L, a[i].len) - result = newString(L) - setLen(result, 0) + result = newStringOfCap(L) for i in 0..high(a): add(result, a[i]) else: result = "" @@ -867,9 +865,9 @@ proc validIdentifier*(s: string): bool {.noSideEffect, proc editDistance*(a, b: string): int {.noSideEffect, rtl, extern: "nsuEditDistance".} = - ## returns the edit distance between `a` and `b`. This uses the Levenshtein - ## distance algorithm with only a linear memory overhead. This implementation - ## is highly optimized! + ## returns the edit distance between `a` and `b`. This uses the + ## `Levenshtein`:idx: distance algorithm with only a linear memory overhead. + ## This implementation is highly optimized! var len1 = a.len var len2 = b.len if len1 > len2: |