CollectionType

protocol CollectionType : Indexable, SequenceType
  • Return everything before the first occurrence of ‘separator’ as ‘head’, and everything after it as ‘tail’. Including empty sequences if ‘separator’ is first or last.

    If ‘separator’ is not found then ‘head’ contains everything and 'tail’ is nil.

    Declaration

    Swift

    public func splitOnce (separator: Generator.Element) -> (head: SubSequence, tail: SubSequence?)