Java DecimalFormatSymbols getAvailableLocales()方法及实例
Java中 java.text .DecimalFormatSymbols类 的 getAvailableLocales() 方法是用来获取该DecimalFormatSymbols的所有可用Locales的列表。该方法返回一个可用地域的数组。
语法。
public static Locales[] getAvailableLocales()
参数。此方法不接受任何参数。
返回值。该方法返回该DecimalFormatSymbols的所有可用地区的数组。
异常。此方法不抛出任何异常。
程序。
// Java program to demonstrate
// the above method
import java.text.*;
import java.util.*;
public class DecimalFormatSymbolsDemo {
public static void main(String[] args)
{
DecimalFormatSymbols dfs
= new DecimalFormatSymbols();
System.out.println("Available Locales: "
+ Arrays.toString(
dfs.getAvailableLocales()));
}
}
输出:
Available Locales: [, ar_AE, ar_JO, ar_SY, hr_HR, fr_BE, es_PA, mt_MT, es_VE, bg, zh_TW, it, ko, uk, lv, da_DK, es_PR, vi_VN, en_US, sr_ME, sv_SE,es_BO, en_SG, ar_BH, pt, ar_SA, sk, ar_YE, hi_IN, ga, en_MT, fi_FI, et, sv, cs, sr_BA_#Latn, el, uk_UA, hu, fr_CH, in, es_AR, ar_EG,ja_JP_JP_#u-ca-japanese, es_SV, pt_BR, be, is_IS, cs_CZ, es, pl_PL, tr, ca_ES, sr_CS, ms_MY, hr, lt, es_ES, es_CO, bg_BG, sq, fr,ja, sr_BA, is, es_PY, de, es_EC, es_US, ar_SD, en, ro_RO, en_PH, ca, ar_TN, sr_ME_#Latn, es_GT, sl, ko_KR, el_CY, es_MX, ru_RU,es_HN, zh_HK, no_NO_NY, hu_HU, th_TH, ar_IQ, es_CL, fi, ar_MA, ga_IE, mk, tr_TR, et_EE, ar_QA, sr__#Latn, pt_PT, fr_LU, ar_OM, th,sq_AL, es_DO, es_CU, ar, ru, en_NZ, sr_RS, de_CH, es_UY, ms, el_GR, iw_IL, en_ZA, th_TH_TH_#u-nu-thai, hi, fr_FR, de_AT, nl, no_NO,en_AU, vi, nl_NL, fr_CA, lv_LV, de_LU, es_CR, ar_KW, sr, ar_LY, mt, it_CH, da, de_DE, ar_DZ, sk_SK, lt_LT, it_IT, en_IE, zh_SG,ro, en_CA, nl_BE, no, pl, zh_CN, ja_JP, de_GR, sr_RS_#Latn, iw, en_IN, ar_LB, es_NI, zh, mk_MK, be_BY, sl_SI, es_PE, in_ID, en_GB]
参考资料: https://docs.oracle.com/javase/9/docs/api/java/text/DecimalFormatSymbols.html#getAvailableLocales-