commonPrefix(with:options:)

Returns a string containing characters this string and the given string have in common, starting from the beginning of each up to the first characters that aren’t equivalent.

Declaration

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