BidirectionalCollection
extension BidirectionalCollection where Element: Equatable
-
Returns
(head: a, tail: b)whereais the prefix up to the last occurrence ofelementandbcontains the remaining elements.ais empty ifelementis not inself.Complexity
O(n), where n is the length of the collection.Declaration
Swift
public func split(atLastIndexOf element: Element) -> (head: SubSequence, tail: SubSequence)
View on GitHub