[enh] isUpperAscii*, isLowerAscii* speedup execution by stopping
iteration as soon as possible
This commit is contained in:
parent
8b30506f72
commit
b1a369d2fb
1 changed files with 6 additions and 4 deletions
|
|
@ -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".} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue