다음을 통해 공유


CollationKey.Merge(CollationKey) Method

Definition

Merges this CollationKey with another.

[Android.Runtime.Register("merge", "(Landroid/icu/text/CollationKey;)Landroid/icu/text/CollationKey;", "", ApiSince=24)]
public Android.Icu.Text.CollationKey? Merge (Android.Icu.Text.CollationKey? source);
[<Android.Runtime.Register("merge", "(Landroid/icu/text/CollationKey;)Landroid/icu/text/CollationKey;", "", ApiSince=24)>]
member this.Merge : Android.Icu.Text.CollationKey -> Android.Icu.Text.CollationKey

Parameters

source
CollationKey

CollationKey to merge with

Returns

a CollationKey that contains the valid merged sort keys with a null String representation, i.e. new CollationKey(null, merged_sort_keys)

Attributes

Remarks

Merges this CollationKey with another. The levels are merged with their corresponding counterparts (primaries with primaries, secondaries with secondaries etc.). Between the values from the same level a separator is inserted.

This is useful, for example, for combining sort keys from first and last names to sort such pairs. See http://www.unicode.org/reports/tr10/#Merging_Sort_Keys

The recommended way to achieve "merged" sorting is by concatenating strings with U+FFFE between them. The concatenation has the same sort order as the merged sort keys, but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\uFFFE' + str2). Using strings with U+FFFE may yield shorter sort keys.

For details about Sort Key Features see https://unicode-org.github.io/icu/userguide/collation/api#sort-key-features

It is possible to merge multiple sort keys by consecutively merging another one with the intermediate result.

Only the sort key bytes of the CollationKeys are merged. This API does not attempt to merge the String representations of the CollationKeys, hence null will be returned as the result's String representation.

Example (uncompressed):

191B1D 01 050505 01 910505 00
            1F2123 01 050505 01 910505 00

will be merged as

191B1D 02 1F2123 01 050505 02 050505 01 910505 02 910505 00

Java documentation for android.icu.text.CollationKey.merge(android.icu.text.CollationKey).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to