java.util.Currency

java 货币工具类

class Test{
    public static void main(String[] args) throws ParseException {
    //通过Locale获取货币对象
    Currency currency = Currency.getInstance(Locale.CHINA);
    //通过货币代码获取货币对象
    Currency currency1 = Currency.getInstance("CNY");
    //通过Locale和CurrencyCode获取的相同的货币对象
    System.out.println(currency.equals(currency1));
    //获取货币代码
    System.out.println(currency.getCurrencyCode());
    //获取货币小数位数,例如(欧元为2,日元为0,人民币为2)
    System.out.println(currency.getDefaultFractionDigits());
    //获取货币的名称
    System.out.println(currency.getDisplayName());
    //使用指定国家文字获取货币的名称
    System.out.println(currency.getDisplayName(Locale.KOREA));
    //获取货币的数字代码标识
    System.out.println(currency.getNumericCode());
    //获取货币符号
    System.out.println(currency.getSymbol());
    //获取指定国家使用该货币的符号
    System.out.println(currency.getSymbol(Locale.UK));
    //获取所有可使用的货币的集合
    System.out.println(currency.getAvailableCurrencies());
    }
}
2
人民币
중국 위안 인민폐
156
¥
CNY
[AZN, KRW, NIO, BSD, XSU, XBD, PLN, ADP, KMF, IQD, CDF, BMD, VEB, NOK, BWP, STD, HRK, LAK, AUD, PYG, ZWD, KHR, XAG, CRC, BDT, PAB, XOF, AFN, AZM, LYD, SYP, LBP, CVE, BYB, XPT, RUR, SRG, MRO, MZM, USD, NZD, KYD, AOA, DKK, NLG, RSD, GWP, SAR, ANG, WST, FJD, AFA, ATS, ROL, SOS, XPF, HUF, SGD, BAM, MOP, GNF, FIM, USS, SZL, LRD, EGP, CHF, GBP, BYR, TWD, XBC, XPD, CUP, DZD, MKD, ESP, MMK, XFO, UAH, INR, RUB, MVR, GRD, BOB, FRF, IDR, XTS, PEN, COP, ERN, BGN, SRD, XDR, VEF, KGS, HNL, YER, ETB, GHS, ZWN, MGA, KWD, AWG, MNT, MAD, JPY, NPR, JOD, TMM, ZAR, CAD, ARS, OMR, HTG, ITL, GEL, YUM, KPW, VUV, KZT, PTE, MUR, MXV, XCD, CUC, ILS, ISK, SKK, LTL, IEP, GTQ, SLL, USN, RON, PGK, MXN, XAF, XFU, RWF, SEK, SDG, BBD, MYR, HKD, DOP, UYU, MZN, ALL, BZD, VND, XBA, TND, TMT, LVL, AYM, SDD, MDL, LKR, CSD, TRY, AED, BEF, BGL, XBB, JMD, ZMW, ZWL, GHC, LSL, CNY, XXX, MWK, QAR, ZWR, BTN, TOP, EUR, CLP, KES, UGX, DEM, CLF, SCR, FKP, GYD, PHP, TPE, BND, MTL, ZMK, SVC, BOV, UZS, NGN, LUF, CZK, SIT, DJF, NAD, GMD, SHP, EEK, PKR, IRR, TRL, TTD, CYP, SBD, AMD, MGF, BHD, TZS, THB, XUA, BRL, GIP, TJS, XAU, SSP, BIF]

 

posted @ 2018-02-07 16:23  maxudong  阅读(1045)  评论(0编辑  收藏  举报