BidirectionalCollection

extension BidirectionalCollection where Element: Equatable

Available where Element: Equatable

  • Returns (head: a, tail: b) where a is the prefix up to the last occurrence of element and b contains the remaining elements. a is empty if element is not in self.

    Complexity

    O(n), where n is the length of the collection.

    Declaration

    Swift

    public func split(atLastIndexOf element: Element) -> (head: SubSequence, tail: SubSequence)