Skip to content

Commit

Permalink
Fixing isNilOrWhitespace to handle empty/nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
euantorano committed Jun 24, 2016
1 parent 7463574 commit f849113
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/pure/strutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit f849113

Please sign in to comment.