Compartilhar via


RuleBasedCollator.GetCollationKey(String) Method

Definition

Get a Collation key for the argument String source from this RuleBasedCollator.

[Android.Runtime.Register("getCollationKey", "(Ljava/lang/String;)Landroid/icu/text/CollationKey;", "", ApiSince=24)]
public override Android.Icu.Text.CollationKey? GetCollationKey (string? source);
[<Android.Runtime.Register("getCollationKey", "(Ljava/lang/String;)Landroid/icu/text/CollationKey;", "", ApiSince=24)>]
override this.GetCollationKey : string -> Android.Icu.Text.CollationKey

Parameters

source
String

the text String to be transformed into a collation key.

Returns

the CollationKey for the given String based on this RuleBasedCollator's collation rules. If the source String is null, a null CollationKey is returned.

Attributes

Remarks

Get a Collation key for the argument String source from this RuleBasedCollator.

General recommendation: <br> If comparison are to be done to the same String multiple times, it would be more efficient to generate CollationKeys for the Strings and use CollationKey.compareTo(CollationKey) for the comparisons. If the each Strings are compared to only once, using the method RuleBasedCollator.compare(String, String) will have a better performance.

See the class documentation for an explanation about CollationKeys.

Java documentation for android.icu.text.RuleBasedCollator.getCollationKey(java.lang.String).

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