diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-18 12:28:19 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2015-01-18 12:28:19 -0500 |
commit | 1bcaa2172967f78513cb638bfc958e2e39d9a049 (patch) | |
tree | 577c50c8c3a1284ef4ea3e9d8026d48499fae5bf /README.asciidoc | |
parent | ff2e3de580e798c4061b8b8a359392974c9091a0 (diff) | |
download | Nim-1bcaa2172967f78513cb638bfc958e2e39d9a049.tar.gz |
Add maxsplit
Diffstat (limited to 'README.asciidoc')
-rw-r--r-- | README.asciidoc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/README.asciidoc b/README.asciidoc index 877ffce47..2fcc05ded 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -54,7 +54,7 @@ Variants: - `proc findAllStr(...)` returns a `seq[string]` [[proc-split]] -==== split(string, Regex): seq[string] +==== split(string, Regex, maxsplit = -1): seq[string] Splits the string with the given regex. This works according to the rules that Perl and Javascript use. @@ -63,6 +63,8 @@ Perl and Javascript use. `"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", ""]`. + - If `maxsplit != -1`, then the string will only be split `maxsplit` times. + `"123".split(re"", maxsplit = 1) == @["1", "23"]` [[proc-replace]] ==== replace(string, Regex, sub): string |