I am using the following code to format the amount entered by user in EditText.
fun String.formatWithComma(): String {
return try {
val formatter = DecimalFormat("#,###,###")
formatter.format(toDouble())
} catch (ex: Exception) {
return ""
}
}
But when I switch the phone language to dutch, the comma is converted to dot (.). Like if user wants to type 4,323 , it is converted to 4.323.
I want to comma instead of dot even in dutch language. Any solution