javajavascriptcurrencycurrency-formatting

Currency Locale- How to get the locale for the different countries


public  double showinbrl(double amount, double rate) {
        double amountinbrl = amount * rate; 
        NumberFormat brl = NumberFormat.getCurrencyInstance(Locale.BRAZIL); 
        brl.format(amountinbrl);
        return amountinbrl;
    }

how to get the locale for the different countries... i cant find locale for brazil..


Solution

  • Try this:

    NumberFormat brl = NumberFormat.getCurrencyInstance(Locale.forLanguageTag("pt_BR"));