compare(_:options:range:)
Returns the result of invoking Compare(_:options:range:locale:) with a nil locale.
Declaration
func compare(_ string: String, options mask: NSString.CompareOptions = [], range rangeOfReceiverToCompare: NSRange) -> ComparisonResultParameters
- string:
The string with which to compare the range of the receiver specified by
range.This value must not be
nil. If this value isnil, the behavior is undefined and may change in future versions of macOS. - mask:
Options for the search—you can combine any of the following using a C bitwise OR operator:
NSCaseInsensitiveSearch,NSLiteralSearch,NSNumericSearch.See 10000035i for details on these options.
- rangeOfReceiverToCompare:
The range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver.
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 is equivalent to invoking compare(_:options:range:locale:) with a nil locale.