split collection to components
Parameters
split collection :string :literal :block
Attributes
words | | split string by whitespace |
lines | | split string by lines |
by | :string, :regex, :block | split using given separator |
at | :integer | split collection at given position |
every | :integer | split collection every *n* elements |
path | | split path components in string |
Returns
Examples
copy
split "hello" ; => [`h` `e` `l` `l` `o`]
copy
split.words "hello world" ; => ["hello" "world"]
copy
split.every: 2 "helloworld"
; => ["he" "ll" "ow" "or" "ld"]
copy
split.at: 4 "helloworld"
; => ["hell" "oworld"]
copy
arr: 1..9
split.at:3 'arr
; => [ [1 2 3 4] [5 6 7 8 9] ]
Related