Handbook
Glossary
split ( seq separators -- pieces )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Splitting sequences
Prev:
split1-last-slice ( seq subseq -- before-slice after-slice )
Next:
split-indices ( seq indices -- pieces )
Vocabulary
splitting
Inputs
seq
a
sequence
separators
a
sequence
Outputs
pieces
a new array
Word description
Splits
seq
at each occurrence of an element of
separators
and outputs an array of pieces. The pieces do not include the elements along which the sequence was split.
Examples
USING: prettyprint splitting ; "hello world-how are you?" " -" split .
{ "hello" "world" "how" "are" "you?" }
Definition
USING:
kernel
sequences
;
IN:
splitting
:
split
( seq separators -- pieces )
[
member?
]
curry
split-when
;
inline