Splitting sequences
Factor handbook » The language » Collections » Sequence operations

Prev:Comparing sequences
Next:Groups and clumps


Splitting sequences at occurrences of subsequences:
?head ( seq begin -- newseq ? )

?head-slice ( seq begin -- newseq ? )

?tail ( seq end -- newseq ? )

?tail-slice ( seq end -- newseq ? )

split1 ( seq subseq -- before after )

split1-slice ( seq subseq -- before-slice after-slice )

split1-when ( ... seq quot: ( ... elt -- ... ? ) -- ... before after )

split1-when-slice ( ... seq quot: ( ... elt -- ... ? ) -- ... before-slice after-slice )

split1-last ( seq subseq -- before after )

split1-last-slice ( seq subseq -- before-slice after-slice )

split ( seq separators -- pieces )

split-indices ( seq indices -- pieces )

split-slice ( seq separators -- pieces )

split-when ( ... seq quot: ( ... elt -- ... ? ) -- ... pieces )

split-when-slice ( ... seq quot: ( ... elt -- ... ? ) -- ... pieces )


Splitting a string into lines:
split-lines ( seq -- seq' )


Replacing subsequences with another subsequence:
replace ( seq old new -- new-seq )