summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-01-16 20:04:20 -0500
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-01-16 20:04:20 -0500
commitabccac2f06d0d8732d79843fda7c50814c8038a3 (patch)
tree8f607ed14e6a277f3bf79a7205867675413f45d3
parent085903cd1063f401c710a5a0dd888fbda5a1bdb9 (diff)
downloadNim-abccac2f06d0d8732d79843fda7c50814c8038a3.tar.gz
Add `split(...)`
-rw-r--r--README.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1f5f40cb7..1a4b49fdd 100644
--- a/README.md
+++ b/README.md
@@ -104,3 +104,15 @@ Variants:
  - `findAllStr(...)` returns a `seq[string]`
 
 [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