Fixing isNilOrWhitespace to handle empty/nil.

This commit is contained in:
Euan 2016-06-24 10:51:13 +01:00
commit f84911364a

View file

@ -333,8 +333,13 @@ proc isNilOrEmpty*(s: string): bool {.noSideEffect, procvar, rtl, extern: "nsuIs
proc isNilOrWhitespace*(s: string): bool {.noSideEffect, procvar, rtl, extern: "nsuIsNilOrWhitespace".} = proc isNilOrWhitespace*(s: string): bool {.noSideEffect, procvar, rtl, extern: "nsuIsNilOrWhitespace".} =
## Checks if `s` is nil or consists entirely of whitespace characters. ## Checks if `s` is nil or consists entirely of whitespace characters.
## if len(s) == 0:
## This is an alias to `isSpace`. return true
result = true
for c in s:
if not c.isSpace():
return false
iterator split*(s: string, seps: set[char] = Whitespace, iterator split*(s: string, seps: set[char] = Whitespace,
maxsplit: int = -1): string = maxsplit: int = -1): string =