I've seen various queries here on splitting a Swift string. But they always deal with using either a single character or one of a set of individual characters to split the string. How do I split one string with another? For example, what if I want to split on CR-LF? The analogous Sequence
/Collection
interfaces have the same problem, I can split on a single Element
value, or one of a set of Element
values, but not on a specific sub-sequence (actually, sub-collection since the value needs to be repeatedly visitable).
Is there some methods I'm missing? Or do I have to manually search by looping through the receiver Sequence
finding the first element of the matching Collection
, then return only if the rest of the collection is found at that sequence point?