diff options
Diffstat (limited to 'lib/pure/strutils.nim')
-rw-r--r-- | lib/pure/strutils.nim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index bfc32bc71..14877eb4d 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -179,9 +179,10 @@ proc isLowerAscii*(s: string): bool {.noSideEffect, procvar, if s.len() == 0: return false - result = true for c in s: - result = c.isLowerAscii() and result + if not c.isLowerAscii(): + return false + true proc isUpperAscii*(s: string): bool {.noSideEffect, procvar, rtl, extern: "nsuIsUpperAsciiStr".}= @@ -193,9 +194,10 @@ proc isUpperAscii*(s: string): bool {.noSideEffect, procvar, if s.len() == 0: return false - result = true for c in s: - result = c.isUpperAscii() and result + if not c.isUpperAscii(): + return false + true proc toLowerAscii*(c: char): char {.noSideEffect, procvar, rtl, extern: "nsuToLowerAsciiChar".} = @@ -1307,10 +1309,12 @@ proc join*[T: not string](a: openArray[T], sep: string = ""): string {. type SkipTable = array[char, int] +{.push profiler: off.} proc preprocessSub(sub: string, a: var SkipTable) = var m = len(sub) for i in 0..0xff: a[chr(i)] = m+1 for i in 0..m-1: a[sub[i]] = m-i +{.pop.} proc findAux(s, sub: string, start: int, a: SkipTable): int = # Fast "quick search" algorithm: |