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

<i id='DOTSr'><tr id='DOTSr'><dt id='DOTSr'><q id='DOTSr'><span id='DOTSr'><b id='DOTSr'><form id='DOTSr'><ins id='DOTSr'></ins><ul id='DOTSr'></ul><sub id='DOTSr'></sub></form><legend id='DOTSr'></legend><bdo id='DOTSr'><pre id='DOTSr'><center id='DOTSr'></center></pre></bdo></b><th id='DOTSr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='DOTSr'><tfoot id='DOTSr'></tfoot><dl id='DOTSr'><fieldset id='DOTSr'></fieldset></dl></div>
  • <legend id='DOTSr'><style id='DOTSr'><dir id='DOTSr'><q id='DOTSr'></q></dir></style></legend>

    1. <small id='DOTSr'></small><noframes id='DOTSr'>

          <bdo id='DOTSr'></bdo><ul id='DOTSr'></ul>

      1. <tfoot id='DOTSr'></tfoot>

        在 Java 中的外國語言環境中格式化貨幣

        Formatting Currencies in Foreign Locales in Java(在 Java 中的外國語言環境中格式化貨幣)

            <legend id='6xnyj'><style id='6xnyj'><dir id='6xnyj'><q id='6xnyj'></q></dir></style></legend>

                <bdo id='6xnyj'></bdo><ul id='6xnyj'></ul>
                  <tfoot id='6xnyj'></tfoot>

                  <small id='6xnyj'></small><noframes id='6xnyj'>

                    <tbody id='6xnyj'></tbody>

                  <i id='6xnyj'><tr id='6xnyj'><dt id='6xnyj'><q id='6xnyj'><span id='6xnyj'><b id='6xnyj'><form id='6xnyj'><ins id='6xnyj'></ins><ul id='6xnyj'></ul><sub id='6xnyj'></sub></form><legend id='6xnyj'></legend><bdo id='6xnyj'><pre id='6xnyj'><center id='6xnyj'></center></pre></bdo></b><th id='6xnyj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6xnyj'><tfoot id='6xnyj'></tfoot><dl id='6xnyj'><fieldset id='6xnyj'></fieldset></dl></div>
                • 本文介紹了在 Java 中的外國語言環境中格式化貨幣的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在盡我最大的努力尋找一種方法,使用 Java 來在各種語言環境中格式化外幣,這些語言不是該貨幣的默認設置.我找到了 java.util.Currency,它可以代表用于各種語言環境的正確符號.也就是說,對于美元,它在美國為我提供符號 $,在其他國家提供美元或美元.此外,我還找到了 java.text.NumberFormat,它將為特定語言環境格式化貨幣.我的問題 - util.Currency 將提供適當的符號和代碼來表示其非默認語言環境中的貨幣,但不會以任何特定于語言環境的方式格式化貨幣.NumberFormat 假定我傳遞給它的數字(帶有語言環境)是該語言環境的貨幣,而不是外幣.

                  I'm doing my best to find a way to format foreign currencies across various locales which are not default for that currency, using Java. I've found java.util.Currency, which can represent the proper symbol to use for various locales. That is, for USD, it provides me the symbol $ in the US, and US$ or USD in other nations. Also, I've found java.text.NumberFormat, which will format a currency for a specific locale. My problem - util.Currency will provide proper symbols and codes for representing currencies in their non-default locales, but will not format currency in any locale-specific way. NumberFormat assumes that the number I pass it, with a locale, is the currency of that locale, not a foreign currency.

                  例如,如果我使用 getCurrencyInstance(Locale.GERMANY) 然后格式化 (1000) 它假定我正在格式化 1000 歐元.實際上,對于美元、日元或任何其他貨幣,我可能需要正確的德語本地化表示(正確的小數和千位分隔符,無論是在金額之前還是之后放置符號).到目前為止,我能夠得出的最好的結果是使用 NumberFormat 格式化數字,然后在輸出中搜索非數字字符并將它們替換為從 util.Currency 派生的符號.但是,這非常脆弱,對于我的目的來說可能不夠可靠.想法?任何幫助深表感謝.

                  For example, if I use getCurrencyInstance(Locale.GERMANY) and then format (1000) it assumes I am formatting 1000 euro. In reality, I may need the correct German-localized representation (correct decimal and thousands separator, whether to put the symbol before or after the amount) for USD, or Yen, or any other currency. The best I've been able to derive so far is to format a number using NumberFormat, then search the output for non-digit characters and replace them with symbols derived from util.Currency. However, this is very brittle, and probably not reliable enough for my purposes. Ideas? Any help is much appreciated.

                  推薦答案

                  嘗試使用setCurrency 在 getCurrencyInstance(Locale.GERMANY) 返回的實例上

                  Try using setCurrency on the instance returned by getCurrencyInstance(Locale.GERMANY)

                  壞了:

                  java.text.NumberFormat format = java.text.NumberFormat.getCurrencyInstance(java.util.Locale.GERMANY);
                  System.out.println(format.format(23));
                  

                  產出:23,00 歐元

                  Output: 23,00 €

                  固定:

                  java.util.Currency usd = java.util.Currency.getInstance("USD");
                  java.text.NumberFormat format = java.text.NumberFormat.getCurrencyInstance(java.util.Locale.GERMANY);
                  format.setCurrency(usd);
                  System.out.println(format.format(23));
                  

                  產出:23,00 美元

                  Output: 23,00 USD

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

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                        <tbody id='qZzHe'></tbody>
                      • <bdo id='qZzHe'></bdo><ul id='qZzHe'></ul>

                        <i id='qZzHe'><tr id='qZzHe'><dt id='qZzHe'><q id='qZzHe'><span id='qZzHe'><b id='qZzHe'><form id='qZzHe'><ins id='qZzHe'></ins><ul id='qZzHe'></ul><sub id='qZzHe'></sub></form><legend id='qZzHe'></legend><bdo id='qZzHe'><pre id='qZzHe'><center id='qZzHe'></center></pre></bdo></b><th id='qZzHe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qZzHe'><tfoot id='qZzHe'></tfoot><dl id='qZzHe'><fieldset id='qZzHe'></fieldset></dl></div>
                          <legend id='qZzHe'><style id='qZzHe'><dir id='qZzHe'><q id='qZzHe'></q></dir></style></legend>

                            <tfoot id='qZzHe'></tfoot>

                          1. <small id='qZzHe'></small><noframes id='qZzHe'>

                          2. 主站蜘蛛池模板: 中文字幕av在线播放 | 成人网av| 91视频在线观看 | 成人自拍av | 亚洲乱码一区二区三区在线观看 | 欧美激情精品久久久久久变态 | 欧美不卡一区二区三区 | 亚洲精品久久久久久久不卡四虎 | 99精品一区 | 99精品视频免费观看 | 欧美一区二区在线 | 亚州精品天堂中文字幕 | 成年人黄色免费视频 | 欧美成人精品在线观看 | 91国内视频在线 | 日本不卡一区二区三区 | 一区在线视频 | 国产精品中文字幕一区二区三区 | 国产一区二区三区四区五区3d | 美女131mm久久爽爽免费 | 中文字幕不卡在线88 | 久久精品 | 中文字幕在线观看一区二区 | 国产美女一区二区 | 毛色毛片免费看 | 国产视频在线一区二区 | 久久精品在线 | 男女网站免费 | 97色在线观看免费视频 | 国产精久久久 | 亚洲视频在线观看免费 | 国产区在线观看 | 日韩一区二区在线观看视频 | 中文字幕11页 | 91久久精品国产 | 亚洲精品免费视频 | 亚洲高清在线 | 91高清视频在线观看 | av黄色在线| 国产成人综合一区二区三区 | 成人99|