split

Definition: sequence res = split(sequence source, object delimiter=' ', bool no_empty=false, integer limit=0)
Description: Split a sequence on the specified delimiter into a number of sub-sequences.

Returns a sequence, of sub-sequences of source. Any instances of delimiter are removed.
Comments: This function may be applied to a string or a complex sequence.

If no_empty is true, any zero-length sub-sequences are not added to the result sequence. Use this when leading, trailing, and duplicated delimiters are not significant.

If limit is greater than 0, it specifies the maximum number of sub-sequences that will be created, otherwise there is no limit.

The use of named parameters is advised when setting no_empty and/or limit.

When dealing with strings, split is the logical counterpart to join().
Examples:
?split("one two three")                         -- {"one","two","three"}
?split("123","")                                -- {"1","2","3"}
?split(" John   Middle  Doe  ")                 -- {"","John","","","Middle","","Doe","",""}
?split(" John   Middle  Doe  ",no_empty:=true)  -- {"John","Middle","Doe"}

The use of a named parameter for no_empty makes the intent much clearer.
Implementation: See builtins\psplit.e (an autoinclude) for details of the actual implementation.
See Also: split_path, join, flatten, columnize