Search code examples
javaandroidlocalenumber-formatting

Why does Android's NumberFormat use a comma as a decimal separator for Australia?


Using the android.icu.text.NumberFormat class:

NumberFormat numberFormat =  NumberFormat.getNumberInstance(Locale("en", "AU")); 
numberFormat.isGroupingUsed = true
String number = numberFormat.format(123456)

will produce 123,456, but according to Wikipedia, Australia uses a point . as the decimal separator. Why is NumberFormat behaving that way?


Solution

  • Number 123456 does not have decimals. You're observing the thousands grouping symbol ,, not the decimal point.