久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

語言環境貨幣符號

Locale Currency Symbol(語言環境貨幣符號)
本文介紹了語言環境貨幣符號的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我在獲取系統的默認貨幣符號時遇到了一些問題.我以這種方式獲取貨幣符號:

I having some problems getting the default currency symbol of the system. I am getting the currency symbol this way:

Currency currency = Currency.getInstance(Locale.getDefault());
Log.v("TAG",currency.getSymbol());

當系統語言為英語(美國)時,右側的符號會顯示($).但是當我選擇語言 Portuguese (Portugal) 它返回這個符號 ¤.

When the system language is in English (United States) the right symbol shows up ($). But when i choose the language Portuguese (Portugal) it returns this symbol ¤.

這是什么原因造成的?

推薦答案

這似乎是一個已知問題(http://code.google.com/p/android/issues/detail?id=38622.我通過這種方式得出了一個可能的解決方案:

This seems to be a known issue (http://code.google.com/p/android/issues/detail?id=38622. I came to a possible solution this way:

由于問題出在符號而不是貨幣代碼中,我解決了這個問題,創建了一個靜態Map,其中鍵是 CurrencyCode,值是 符號.

Since the problem is in the Symbol and not the Currency code, i solved this problem creating a staticMap where the key is the CurrencyCode and the value is the Symbol.

public static final Map<String, String> MYCURRENCIES = new HashMap<String, String>(){
        {
            put("EUR","€");
            put("USD","$");
            (..)
        }
};

為了獲取語言環境信息中可用的所有(或幾乎)貨幣代碼,您可以執行以下操作:

In order to get all (or almost) the currencies codes available in the locales information you can do something like this:

for (Locale ll: Locale.getAvailableLocales()){
    try {
       Currency a = Currency.getInstance(ll);
       Log.v("MyCurrency",a.getCurrencyCode()+"#"+a.getSymbol());
    }catch (Exception e){
       // when the locale is not supported
  }
}

使用 CurrencyCodeSymbol 創建地圖后,您只需要這樣:

After you created you Map with the CurrencyCode and Symbol you just have to something like this:

Currency currency = Currency.getInstance(Locale.getDefault());
String curSymbol = MYCURRENCIES.get(currency.getCurrencyCode());

這篇關于語言環境貨幣符號的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 成人在线视频免费观看 | 欧美一级黄带 | 亚洲视频免费在线观看 | 酒色成人网 | 日本福利一区 | 日本一区二区视频 | 免费三级网 | 青青久久 | 日韩中文字幕一区二区 | 国产一区二区视频在线观看 | 99精品视频免费在线观看 | 草逼网站| 亚洲欧美在线观看视频 | 九九色综合 | 夜夜爽99久久国产综合精品女不卡 | 中文av字幕 | 日韩字幕| 视频一区二区在线观看 | 欧美中文在线 | yeyeav| 天天拍天天操 | 黄在线免费观看 | 欧美成人猛片aaaaaaa | 免费久久视频 | 久久69精品久久久久久国产越南 | 成人亚洲片 | 国产精品欧美精品日韩精品 | 久久国产婷婷国产香蕉 | 免费a级毛片在线播放 | 欧美xxxx性 | 99热电影| 久久久久久国产精品 | 99九色 | 四虎影院久久 | 福利视频一区二区三区 | 国产欧美日韩综合精品一区二区 | 日韩精品极品视频在线观看免费 | 午夜精品久久 | 亚洲精品国产第一综合99久久 | 巨大荫蒂视频欧美另类大 | 亚洲大片在线观看 |