Instance Method

caseInsensitiveCompare(_:)

Returns the result of invoking compare(_:options:) with NSCaseInsensitiveSearch as the only option.

Declaration

func caseInsensitiveCompare(_ string: String) -> ComparisonResult

Parameters

aString

The string with which to compare the receiver.

Return Value

Returns an ComparisonResult value that indicates the lexical ordering. orderedAscending the receiver precedes aString in lexical ordering, orderedSame the receiver and aString are equivalent in lexical value, and orderedDescending if the receiver follows aString.

Discussion

This method is the equivalent of invoking compare(_:options:) with caseInsensitive as the only option.

See Also

Identifying and Comparing Strings

func localizedCaseInsensitiveCompare(String)

Compares the string with a given string using a case-insensitive, localized, comparison.

func compare(String)

Returns the result of invoking compare(_:options:range:) with no options and the receiver’s full extent as the range.

func localizedCompare(String)

Compares the string and a given string using a localized comparison.

func compare(String, options: NSString.CompareOptions = [])

Compares the string with the specified string using the given options.

func compare(String, options: NSString.CompareOptions = [], range: NSRange, locale: Any?)

Compares the string using the specified options and returns the lexical ordering for the range.

func localizedStandardCompare(String)

Compares strings as sorted by the Finder.

func hasPrefix(String)

Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.

func hasSuffix(String)

Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.

func isEqual(to: String)

Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.

var hash: Int

An unsigned integer that can be used as a hash table address.