TWD 顯示改為整數(四捨五入到個位)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user