語言

RuleBasedCollator.GetCollationKey(String) 方法

定義

從這個 RuleBasedCollator 取得參數 String source 的 Collation 鍵。

[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

參數

source
String

將文字 String 轉換成一個整合鍵。

傳回

根據此 RuleBasedCollator 的排序規則,為給定字串建立 CollationKey 。 若原始字串為空,則回傳一個空的 CollationKey。

屬性

備註

從這個 RuleBasedCollator 取得參數 String source 的 Collation 鍵。

一般建議: <br> 如果要多次對同一字串進行比較,最好為字串產生 CollationKeys,並使用 CollationKey.compareTo(CollationKey) 進行比較。 如果每個字串只比較一次,使用 RuleBasedCollator.compare(String, String) 的方法會有更好的效能。

請參閱類別文件中關於 CollationKey 的說明。

Java 文件 android.icu.text.RuleBasedCollator.getCollationKey(java.lang.String)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於