Get the currency format for a country that does not have a Locale constant

前端 未结 6 1105
醉梦人生
醉梦人生 2020-12-29 02:44

I want to get the currency format of India, so I need a Locale object for India. But there exists only few a countries that have a Locale constant

6条回答
  •  一个人的身影
    2020-12-29 03:18

    heres is simple thing u can do ,

      float amount = 100000;
    
      NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
    
      String moneyString = formatter.format(amount);
    
      System.out.println(moneyString);
    

    The output will be , Rs.100,000.00 .

提交回复
热议问题