Add split(...)
This commit is contained in:
parent
085903cd10
commit
abccac2f06
1 changed files with 12 additions and 0 deletions
12
README.md
12
README.md
|
|
@ -104,3 +104,15 @@ Variants:
|
||||||
- `findAllStr(...)` returns a `seq[string]`
|
- `findAllStr(...)` returns a `seq[string]`
|
||||||
|
|
||||||
[iter-find]: #finditerstring-regex-start--0-endpos---1-regexmatch
|
[iter-find]: #finditerstring-regex-start--0-endpos---1-regexmatch
|
||||||
|
|
||||||
|
#### `split(string, Regex): seq[string]`
|
||||||
|
|
||||||
|
Splits the string with the given regex. This works according to the rules that
|
||||||
|
Perl and Javascript use.
|
||||||
|
|
||||||
|
- If the match is zero-width, then the string is still split:
|
||||||
|
`"123".split(r"") == @["1", "2", "3"]`.
|
||||||
|
- If the pattern has a capture in it, it is added after the string split:
|
||||||
|
`"12".split(re"(\d)") == @["", "1", "", "2", ""]`.
|
||||||
|
|
||||||
|
[proc-split]: #splitstring-regex-seqstring
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue