Fixing isNilOrWhitespace to handle empty/nil.

This commit is contained in:
Euan
2016-06-24 10:51:13 +01:00
parent 746357404c
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".} =
## Checks if `s` is nil or consists entirely of whitespace characters.
##
## This is an alias to `isSpace`.
if len(s) == 0:
return true
result = true
for c in s:
if not c.isSpace():
return false
iterator split*(s: string, seps: set[char] = Whitespace,
maxsplit: int = -1): string =