parent
a693ce7765
commit
dc94c81cb0
2 changed files with 8 additions and 4 deletions
|
|
@ -115,6 +115,9 @@ echo f
|
||||||
serve no purpose whatsoever.
|
serve no purpose whatsoever.
|
||||||
- `httpclient.newHttpClient` and `httpclient.newAsyncHttpClient` added `headers`
|
- `httpclient.newHttpClient` and `httpclient.newAsyncHttpClient` added `headers`
|
||||||
argument to set initial HTTP Headers, instead of a hardcoded empty `newHttpHeader()`.
|
argument to set initial HTTP Headers, instead of a hardcoded empty `newHttpHeader()`.
|
||||||
|
- `parseutils.parseUntil` has now a different behaviour if the `until` parameter is
|
||||||
|
empty. This was required for intuitive behaviour of the strscans module
|
||||||
|
(see bug #13605).
|
||||||
|
|
||||||
|
|
||||||
## Language additions
|
## Language additions
|
||||||
|
|
|
||||||
|
|
@ -354,12 +354,13 @@ proc parseUntil*(s: string, token: var string, until: string,
|
||||||
doAssert myToken == "Hello "
|
doAssert myToken == "Hello "
|
||||||
doAssert parseUntil("Hello World", myToken, "Wor", 2) == 4
|
doAssert parseUntil("Hello World", myToken, "Wor", 2) == 4
|
||||||
doAssert myToken == "llo "
|
doAssert myToken == "llo "
|
||||||
|
when (NimMajor, NimMinor) <= (1, 0):
|
||||||
if until.len == 0:
|
if until.len == 0:
|
||||||
token.setLen(0)
|
token.setLen(0)
|
||||||
return 0
|
return 0
|
||||||
var i = start
|
var i = start
|
||||||
while i < s.len:
|
while i < s.len:
|
||||||
if s[i] == until[0]:
|
if until.len > 0 and s[i] == until[0]:
|
||||||
var u = 1
|
var u = 1
|
||||||
while i+u < s.len and u < until.len and s[i+u] == until[u]:
|
while i+u < s.len and u < until.len and s[i+u] == until[u]:
|
||||||
inc u
|
inc u
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue