Basically, I want to format a string number into an appropriate looking local format. For example, "15000" into looking more or less like my locale currency format. i.e "Rp.15.000"
Basically, the problem arises since your Locale constant is not readily available.
That is, there is no such thing as Locale.INDONESIAN
, or Locale.ALBANIAN
, or Locale.LATVIAN
.
TL;DR for Indonesian Rupiah format:
Locale myIndonesianLocale = new Locale("in", "ID");
NumberFormat formater = NumberFormat.getCurrencyInstance(myIndonesianLocale);
That's for Indonesian locale, what about other locales?
Go to: https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html (please pay attention to Language Tag).
For Albanian locale pair: sq-AL:
Locale myAlbanianLocale = new Locale("sq", "AL");
For Latvian locale pair: lv-LV
Locale myAlbanianLocale = new Locale("lv", "LV");
And so on.