mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 23:05:27 +00:00
@@ -354,12 +354,13 @@ proc parseUntil*(s: string, token: var string, until: string,
|
||||
doAssert myToken == "Hello "
|
||||
doAssert parseUntil("Hello World", myToken, "Wor", 2) == 4
|
||||
doAssert myToken == "llo "
|
||||
if until.len == 0:
|
||||
token.setLen(0)
|
||||
return 0
|
||||
when (NimMajor, NimMinor) <= (1, 0):
|
||||
if until.len == 0:
|
||||
token.setLen(0)
|
||||
return 0
|
||||
var i = start
|
||||
while i < s.len:
|
||||
if s[i] == until[0]:
|
||||
if until.len > 0 and s[i] == until[0]:
|
||||
var u = 1
|
||||
while i+u < s.len and u < until.len and s[i+u] == until[u]:
|
||||
inc u
|
||||
|
||||
Reference in New Issue
Block a user