Merge docs for 'Merge pull request #666 from altrisi/extra-splitting

[Suggestion] Allow splitting lists by element value'
This commit is contained in:
github-actions[bot] committed 2021-01-14 01:25:00 +00:00
1 parent d563e65c77
commit 97609d9c44
1 file changed
+8
+8
View File
@@ -1655,11 +1655,19 @@ join('-', 'foo', 'bar') => foo-bar
Splits a string under `expr` by `delim` which can be a regular expression. If no delimiter is specified, it splits Splits a string under `expr` by `delim` which can be a regular expression. If no delimiter is specified, it splits
by characters. by characters.
If `expr` is a list, it will split the list into multiple sublists by the element (s) which equal `delim`, or which equal the empty string
in case no delimiter is specified.
Splitting a `null` value will return an empty list.
<pre> <pre>
split('foo') => [f, o, o] split('foo') => [f, o, o]
split('','foo') => [f, o, o] split('','foo') => [f, o, o]
split('.','foo.bar') => [] split('.','foo.bar') => []
split('\\.','foo.bar') => [foo, bar] split('\\.','foo.bar') => [foo, bar]
split(1,[2,5,1,2,3,1,5,6]) => [[2,5],[2,3],[5,6]]
split(1,[1,2,3,1,4,5,1] => [[], [2,3], [4,5], []]
split(null) => []
</pre> </pre>
### `slice(expr, from, to?)` ### `slice(expr, from, to?)`