Fixes for parseUntil when until.len == 0 (or nil)

This commit is contained in:
data-man
2018-05-25 18:52:04 +03:00
parent 6536535470
commit 856dc4c5c1

View File

@@ -197,6 +197,9 @@ proc parseUntil*(s: string, token: var string, until: string,
## parses a token and stores it in ``token``. Returns
## the number of the parsed characters or 0 in case of an error. A token
## consists of any character that comes before the `until` token.
if until.len == 0:
token.setLen(0)
return 0
var i = start
while i < s.len:
if s[i] == until[0]: