StringProtocol

protocol StringProtocol : BidirectionalCollection, Comparable, ExpressibleByStringInterpolation, Hashable, LosslessStringConvertible, TextOutputStream, TextOutputStreamable where Self.Element == Character, Self.Index == String.Index, Self.StringInterpolation == DefaultStringInterpolation, Self.SubSequence : StringProtocol
  • SwifterSwift: The longest common suffix.

       "Hello world!".commonSuffix(with: "It's cold!") = "ld!"
    

    Declaration

    Swift

    func commonSuffix<T>(with aString: T, options: String.CompareOptions = []) -> String where T : StringProtocol

    Return Value

    The longest common suffix of the receiver and the given String