如何在安卓系统中用`getCurrencyInstance`获取印尼莱克货币格式器?那其他地区的货币如阿尔巴尼亚列克币呢?

问题描述 投票:0回答:1

基本上,我想把一个字符串的数字格式化成一个合适的本地格式,例如,"15000 "看起来或多或少像我的本地货币格式,即 "Rp.15.000"。

android currency number-formatting currency-formatting numberformatter
1个回答
0
投票

基本上,问题出现了,因为你的Locale常量不是现成的。Locale.INDONESIANLocale.ALBANIANLocale.LATVIAN.

TL;DR的印尼盾格式。

Locale myIndonesianLocale = new Locale("in", "ID");
NumberFormat formater = NumberFormat.getCurrencyInstance(myIndonesianLocale);

那是印尼语地区的,其他地区呢?

请到 https:/www.oracle.comjavatechnologiesjavasejdk8-jre8-suported-locales.html请注意语言标签)。

阿尔巴尼亚语的语言对:sq-AL。Locale myAlbanianLocale = new Locale("sq", "AL");

对于拉脱维亚语区域对:lv-LV。Locale myAlbanianLocale = new Locale("lv", "LV");

等等。

© www.soinside.com 2019 - 2024. All rights reserved.