public double showinbrl(double amount, double rate) {
double amountinbrl = amount * rate;
NumberFormat brl = NumberFormat.getCurrencyInstance(Locale.BRAZIL);
brl.format(amountinbrl);
return amountinbrl;
}
如何获得不同国家的区域设置。我找不到巴西的地方。
2条答案
按热度按时间8yoxcaq71#
试试这个:
ifmq2ha22#
更新2023(Kotlin):
当我尝试使用“Locale.forLanguageTag(“pt_BR”)“时,它对我不起作用,它的格式不正确,并且显示了一个未知字符:
所以我在谷歌上搜索并使用了以下代码,它工作了: