Another approach :
NumberFormat format = NumberFormat.getCurrencyInstance();
format.setMaximumFractionDigits(0);
format.setCurrency(Currency.getInstance("EUR"));
format.format(1000000);
This way, it's displaying 1 000 000 € or 1,000,000 €, depending on device currency's display settings
Top answer 1 of 16
83
Another approach :
NumberFormat format = NumberFormat.getCurrencyInstance();
format.setMaximumFractionDigits(0);
format.setCurrency(Currency.getInstance("EUR"));
format.format(1000000);
This way, it's displaying 1 000 000 € or 1,000,000 €, depending on device currency's display settings
2 of 16
50
You need to use a number formatter, like so:
NumberFormat formatter = new DecimalFormat("#,###");
double myNumber = 1000000;
String formattedNumber = formatter.format(myNumber);
//formattedNumber is equal to 1,000,000
Hope this helps!
Medium
medium.com › @jecky999 › formatting-currency-in-kotlin-locale-aware-approach-for-global-apps-1a4038a4489d
Formatting Currency in Kotlin: Locale-Aware Approach for Global Apps | by Jaykishan Sewak | Medium
May 9, 2025 - Each country represents currencies differently. For example: ... The same becomes 123 456,78 € in France. It becomes ₹1,23,456.78 in India, using the lakh/crore system. This makes it critical to format numbers based on the user’s locale. ... Mobile Lead | Android Tech Lead at HSBC | Flutter | MVVM | JetPack Compose | kotlin | Medium blog writer | GitHub Contributor
Android Developers
developer.android.com › api reference › numberformat
NumberFormat | API reference | Android Developers
Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体
Kotlinlang
slack-chats.kotlinlang.org › t › 19613454 › hi-there-is-there-any-kmm-lib-for-currency-formatting-in-a-l
Hi there is there any KMM lib for currency formatting in a l kotlinlang #multiplatform
iosMain import platform.Foundation.NSLocale import platform.Foundation.NSNumber import platform.Foundation.NSNumberFormatter import platform.Foundation.NSNumberFormatterCurrencyStyle private val formatter = NSNumberFormatter().apply { locale = NSLocale(localeIdentifier = "DE") currencyCode = "eur" numberStyle = NSNumberFormatterCurrencyStyle } actual fun parseFormattedStringToCents(formattedAmount: String): BigInteger { return BigInteger(formatter.numberFromString(formattedAmount)?.longValue ?: 0L) } actual fun formatMoney(amount: Double): String { val number = NSNumber(amount) return formatte
GitHub
gist.github.com › bkromhout › 5735475
Currency Utils: A class used on android to parse Locale-formatted currency strings to long values for the purpose of storing in a database, and parsing long currency values to locale-formatted strings. Note that this class does not care about exchange rates and does not attempt to do currency conversions. · GitHub
Currency Utils: A class used on android to parse Locale-formatted currency strings to long values for the purpose of storing in a database, and parsing long currency values to locale-formatted strings.
Cash App Code Blog
code.cash.app › kotlin-multiplatform-money-formatter
Kotlin Multiplatform Money Formatter | Cash App Code Blog
June 6, 2023 - First, we call platform-specific code for localized number formatting (e.g., NSNumberFormatter on iOS, the ICU library built into Android). Then we apply some Cash App specific adjustments in common Kotlin code. Leaning on native platform logic means we don’t have to become experts in each locale and keep the library lightweight. Another challenge was handling scale and precision. 32-bit integers might not be large enough to display amounts in some currencies while floating point numbers can introduce subtle rounding errors for fractional amounts.
Styling Android
blog.stylingandroid.com › currency-curiosities
Currency Curiosities – Styling Android
November 27, 2017 - When we change the currency of the NumberFormat instance it does not change the locale, but when we come to format a currency using that configuration it is context aware enough to format the given currency in a way that it is given any necessary context for the locale from which the NumberFormat instance was obtained.
Sling Academy
slingacademy.com › article › formatting-numbers-for-display-in-kotlin-currency-percentages
Formatting Numbers for Display in Kotlin (Currency, Percentages) - Sling Academy
import java.text.NumberFormat fun ... data. By using these formatting capabilities, Kotlin developers can ensure that currency and percentage values are human-readable and contextually appropriate for any locale....
Kotlinlang
slack-chats.kotlinlang.org › t › 474624 › i-m-trying-to-convert-a-long-amount-in-euro-cents-to-a-reada
I m trying to convert a long amount in euro cents to a reada kotlinlang #getting-started
fun Long.centsToString(): String { val format = NumberFormat.getCurrencyInstance(Locale.ITALY) format.maximumFractionDigits = 2 format.currency = Currency.getInstance("EUR") return format.format(BigDecimal(this).divide(BigDecimal(100.0))) }
Kotlinlang
slack-chats.kotlinlang.org › t › 10062891 › hey-we-need-to-format-prices-in-local-currencies-in-our-kmm-
Hey We need to format prices in local currencies in our kmm kotlinlang #multiplatform
fluid-currency just has the mapping of all the currency codes with the name and doesn't support any formatting so this is not much useful in this context. Is there any latest lib? ... https://kotlinlang.slack.com/archives/C3PQML5NU/p1742498505316619?thread_ts=1742424885.673259&cid=C3PQML5NU