Merge pull request #5003 from zevlg/strutils-enh

[enh] isUpperAscii*, isLowerAscii* speedup execution by stopping
This commit is contained in:
Andreas Rumpf
2016-11-07 13:47:22 +01:00
committed by GitHub

View File

@@ -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".} =