UCCompareTextDefault(_:_:_:_:_:_:_:)
Uses the default system locale to compare Unicode strings.
Declaration
func UCCompareTextDefault(_ options: UCCollateOptions, _ text1Ptr: UnsafePointer<UniChar>!, _ text1Length: Int, _ text2Ptr: UnsafePointer<UniChar>!, _ text2Length: Int, _ equivalent: UnsafeMutablePointer<DarwinBoolean>!, _ order: UnsafeMutablePointer<Int32>!) -> OSStatusParameters
- options:
A
UCCollateOptionsvalue specifying any collation options for the string comparison. - text1Ptr:
A pointer to the first Unicode string (a
UniChararray) to compare. - text1Length:
The total count of Unicode characters in the first string being compared.
- text2Ptr:
A pointer to the second Unicode string to compare.
- text2Length:
The total count of Unicode characters in the second string being compared.
- equivalent:
A pointer to a
Booleanvalue or passNULL. On return,UCCompareTextDefaultproduces a value oftrueif the strings are equivalent for the options you have specified. If you wish simply to sort a list of strings in order, using your specified options, you can passNULLfor theequivalentparameter and only use theorderparameter’s result. In this case, all available comparison criteria are used to put the strings in a deterministic order, even if they are considered “equivalent” for the options you have specified. Note that you can set either theequivalentor theorderparameters toNULL, but not both. - order:
A pointer to a signed, 32-bit integer value, or pass
NULL. If you wish simply to test the strings for equivalence, using your specified options (which can be much faster than determining ordering), you can passNULLfor theorderparameter and only use theequivalentparameter’s result. (Note that either theequivalentor theorderparameters may beNULL, but not both.
Return Value
A result code.
Discussion
You can call the UCCompareTextDefault function when you want to use a simple collation function that requires minimum setup. This function uses the system default collation order (that is, the collation order for a LocaleRef of NULL and a variant of 0), and it does not require a collator object or collation keys.