UCCompareTextNoLocale(_:_:_:_:_:_:_:)
Uses a fixed, locale-insensitive order to compare Unicode strings.
Declaration
func UCCompareTextNoLocale(_ options: UCCollateOptions, _ text1Ptr: UnsafePointer<UniChar>!, _ text1Length: Int, _ text2Ptr: UnsafePointer<UniChar>!, _ text2Length: Int, _ equivalent: UnsafeMutablePointer<DarwinBoolean>!, _ order: UnsafeMutablePointer<Int32>!) -> OSStatusParameters
- options:
A
UCCollateOptionsvalue specifying the fixed ordering scheme to use for the string comparison. This value must be nonzero. Bits 24-31 ofUCCollateOptionsValuespecify which fixed ordering scheme to use. Currently there is only scheme—kUCCollateTypeHFSExtended. See 1390361 Fixed_ordering_scheme for additional details. - 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,UCCompareTextNoLocaleproduces a value oftrueif the strings are equivalent for the ordering scheme you have specified. If you wish simply to sort a list of strings in order, using the specified ordering scheme, 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 specified ordering scheme. 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 the specified ordering scheme (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. This function can return paramErr if you pass an invalid value for one of the parameters. For example, if you pass 0 for the options paramter, the function returns paramErr.
Discussion
You can call the UCCompareTextNoLocale function when you want to perform a fixed, locale-insensitive comparison that is guaranteed not to change from one system release to the next. This type of comparison could be used for sorting a Unicode key string in a database, for example. The UCCompareTextNoLocale function can provide comparison according to various fixed ordering schemes (only one is supported for Mac OS 8.6 and 9.0). This type of comparison is not usually used for a user-visible ordering, so the ordering schemes need not match any user’s expectation of a sensible collation order.
The UCCompareTextNoLocale function does not require a collator object or collation keys. Another advantage of UCCompareTextNoLocale on Mac OS 9 is that it is exported from the UnicodeUtilitiesCoreLib library, which does not depend on other libraries (the other comparison functions exported from UnicodeUtilitiesLib, which depends on LocalesLib and TextCommon).