Handle different Locale when formatting

(ex: 26353,394 instead of 26353.394, which will eventually cause a ANR when formatting)
This commit is contained in:
Hafiz 2023-01-31 15:54:52 -05:00
parent 8518ec5802
commit 2c53b68b5f

View file

@ -23,7 +23,9 @@ object NumberAbbreviator {
if (decimalCount > 0) {
pattern = ("$pattern.").padEnd(4 + decimalCount, '#')
}
val formatter = DecimalFormat(pattern + abbreviationForCounter(context, counter).replace(".", ""))
val formatter = DecimalFormat(pattern + abbreviationForCounter(context, counter)
.replace(".", "")
.replace(",", ""))
formatter.roundingMode = RoundingMode.FLOOR
return formatter.format(usedNumber)
}