[enh] isUpperAscii*, isLowerAscii* speedup execution by stopping

iteration as soon as possible
This commit is contained in:
Zajcev Evgeny
2016-11-07 13:21:17 +03:00
parent 8b30506f72
commit b1a369d2fb

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