Fixes for parseUntil when until.len == 0 (or nil)
This commit is contained in:
parent
6536535470
commit
856dc4c5c1
1 changed files with 3 additions and 0 deletions
|
|
@ -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]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue