split collection to components
Parameters
split collection :string :literal :pathliteral :block
Attributes
words |
|
split string by whitespace |
lines |
|
split string by lines |
by |
:char, :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"]
split.by: "," "hello,world" ; => ["hello" "world"]
split.lines "hello\nworld" ; => ["hello" "world"]
split.path "/usr/bin" ; => ["usr" "bin"]
; windows only:
split.path "\\usr\\bin" ; => ["usr" "bin"]
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