當前位置: 首頁>>代碼示例>>Java>>正文


Java Collator.getAvailableLocales方法代碼示例

本文整理匯總了Java中java.text.Collator.getAvailableLocales方法的典型用法代碼示例。如果您正苦於以下問題:Java Collator.getAvailableLocales方法的具體用法?Java Collator.getAvailableLocales怎麽用?Java Collator.getAvailableLocales使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.text.Collator的用法示例。


在下文中一共展示了Collator.getAvailableLocales方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInstance

import java.text.Collator; //導入方法依賴的package包/類
public static HanziToPinyin getInstance() {
    synchronized (HanziToPinyin.class) {
        if (sInstance != null) {
            return sInstance;
        }
        // Check if zh_CN collation data is available
        final Locale locale[] = Collator.getAvailableLocales();
        for (int i = 0; i < locale.length; i++) {
            if (locale[i].equals(Locale.CHINA)) {
                // Do self validation just once.
                if (DEBUG) {

                    android.util.Log.d(TAG, "Self validation. Result: " +
                            doSelfValidation());
                }
                sInstance = new HanziToPinyin(true);
                return sInstance;
            }
        }
        android.util.Log.w(TAG,
                "There is no Chinese collator, HanziToPinyin is disabled");
        sInstance = new HanziToPinyin(false);
        return sInstance;
    }
}
 
開發者ID:devzwy,項目名稱:KUtils,代碼行數:26,代碼來源:HanziToPinyin.java

示例2: getInstance

import java.text.Collator; //導入方法依賴的package包/類
public static HanziToPinyin getInstance() {
    synchronized (HanziToPinyin.class) {
        if (sInstance != null) {
            return sInstance;
        }
        // Check if zh_CN collation data is available
        final Locale locale[] = Collator.getAvailableLocales();
        for (int i = 0; i < locale.length; i++) {
            if (locale[i].equals(Locale.CHINESE)) {
                // Do self validation just once.
                if (DEBUG) {
                    Log.d(TAG, "Self validation. Result: " + doSelfValidation());
                }
                sInstance = new HanziToPinyin(true);
                return sInstance;
            }
        }
        Log.w(TAG, "There is no Chinese collator, HanziToPinyin is disabled");
        sInstance = new HanziToPinyin(false);
        return sInstance;
    }
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:23,代碼來源:HanziToPinyin.java

示例3: getInstance

import java.text.Collator; //導入方法依賴的package包/類
public static HanziToPinyin3 getInstance() {
    synchronized (HanziToPinyin3.class) {
        if (sInstance != null) {
            return sInstance;
        }
        // Check if zh_CN collation data is available
        final Locale locale[] = Collator.getAvailableLocales();
        for (int i = 0; i < locale.length; i++) {
            if (locale[i].equals(Locale.CHINESE)) {
                // Do self validation just once.
                if (DEBUG) {
                    Log.d(TAG, "Self validation. Result: " + doSelfValidation());
                }
                sInstance = new HanziToPinyin3(true);
                return sInstance;
            }
        }
        Log.w(TAG, "There is no Chinese collator, HanziToPinyin is disabled");
        sInstance = new HanziToPinyin3(false);
        return sInstance;
    }
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:23,代碼來源:HanziToPinyin3.java

示例4: TestGetAll

import java.text.Collator; //導入方法依賴的package包/類
public final void TestGetAll()
{
    Locale[] list = Collator.getAvailableLocales();
    for (int i = 0; i < list.length; ++i) {
        log("Locale name: ");
        log(list[i].toString());
        log(" , the display name is : ");
        logln(list[i].getDisplayName());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:APITest.java


注:本文中的java.text.Collator.getAvailableLocales方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。