Код: Выделить всё
fun getMonthlyPriceString(yearlyPriceMicros: Long, currencyCode: String): String {
val format: NumberFormat = NumberFormat.getCurrencyInstance()
format.maximumFractionDigits = 2
format.currency = Currency.getInstance(currencyCode)
return format.format(yearlyPriceMicros.toFloat() / 1_000_000f / 12)
}
Аргумент «Код валюты» извлекается из внешнего API (RevenueCat) и имеет форму " EUR", "USD", "SGD" и т. д.
Я пробовал заменить код в строке 4 на
Код: Выделить всё
format.currency = Currency.getInstance(Locale.getDefault())
Подробнее здесь: https://stackoverflow.com/questions/777 ... -of-curren