9
0
mirror of https://github.com/Auxilor/EcoBits.git synced 2025-12-19 15:09:19 +00:00
This commit is contained in:
Auxilor
2023-07-20 17:51:06 +01:00
parent d0968397c0
commit bab1a6fc47

View File

@@ -192,8 +192,9 @@ fun BigDecimal.formatWithExtension(): String {
}
fun BigDecimal.formatWithCommas(): String {
val decimalFormat = if (this.scale() > 0) DecimalFormat("#,###.00") else DecimalFormat("#,###")
return decimalFormat.format(this)
val stripped = this.stripTrailingZeros()
val decimalFormat = if (stripped.scale() > 0) DecimalFormat("#,##0.00") else DecimalFormat("#,##0")
return decimalFormat.format(stripped)
}
fun OfflinePlayer.getBalance(currency: Currency): BigDecimal {