split

split collection to components


Parameters

split collection :string :literal :block

Attributes

wordssplit string by whitespace
linessplit string by lines
by:string, :regex, :blocksplit using given separator
at:integersplit collection at given position
every:integersplit collection every *n* elements
pathsplit path components in string

Returns

  • :block
  • or  :nothing

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