TWD 顯示改為整數(四捨五入到個位)

This commit is contained in:
Timmy
2026-04-17 13:12:58 +08:00
parent 6b7eab1095
commit 1f229da736
5 changed files with 7 additions and 11 deletions

View File

@@ -86,10 +86,10 @@ private fun parseAmount(s: String): Double? =
s.filter { it != ',' && !it.isWhitespace() }.takeIf { it.isNotEmpty() }?.toDoubleOrNull()
private fun roundHalfUp(v: Double): BigDecimal =
BigDecimal.valueOf(v).setScale(2, RoundingMode.HALF_UP)
BigDecimal.valueOf(v).setScale(0, RoundingMode.HALF_UP)
private fun formatTwd(v: Double): String =
DecimalFormat("#,##0.00").format(roundHalfUp(v))
DecimalFormat("#,##0").format(roundHalfUp(v))
private fun formatTwdRaw(v: Double): String =
roundHalfUp(v).toPlainString()