localizedCompare(_:)
Compares the string and a given string using a localized comparison.
Declaration
func localizedCompare(_ string: String) -> ComparisonResultParameters
- string:
The string with which to compare the receiver.
This value must not be
nil. If this value isnil, the behavior is undefined and may change in future versions of macOS.
Return Value
Returns an ComparisonResult value that indicates the lexical ordering. ComparisonResult.orderedAscending the receiver precedes aString in lexical ordering, ComparisonResult.orderedSame the receiver and aString are equivalent in lexical value, and ComparisonResult.orderedDescending if the receiver follows aString.
Discussion
This method uses the current locale.