Handbook
Glossary
split1-slice ( seq subseq -- before-slice after-slice )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Splitting sequences
Prev:
split1 ( seq subseq -- before after )
Next:
split1-when ( ... seq quot: ( ... elt -- ... ? ) -- ... before after )
Vocabulary
splitting
Inputs
seq
a
sequence
subseq
a
sequence
Outputs
before-slice
a
slice
after-slice
a
slice
Word description
Splits
seq
at the first occurrence of
subseq
, and outputs the pieces before and after the split as slices. If
subseq
does not occur in
seq
, then
before
is just
seq
and
after
is
f
.
See also
split1
,
split1-last
,
split1-last-slice
Definition
USING:
kernel
;
IN:
splitting
:
split1-slice
( seq subseq -- before-slice after-slice )
[
subseq-range
]
keepd
?snip-slice
;
inline