Updated on 2026-08-14
This commit is contained in:
parent
27f3c6afda
commit
a204ef0bd6
4 changed files with 62 additions and 14 deletions
|
|
@ -160,10 +160,10 @@ private fun String.preserveDecimalSymbol(newValue: String, decimalSymbol: Char)
|
|||
|
||||
private fun String.preserveTrailingZeros(newValue: String, parsedDecimal: BigDecimal?, decimalSymbol: Char): String {
|
||||
val trailingZeros = newValue.split(decimalSymbol).getOrNull(1)?.takeLastWhile { it == '0' }.orEmpty()
|
||||
return if (parsedDecimal?.scale() == 0 && trailingZeros.isNotEmpty()) {
|
||||
"$this$decimalSymbol$trailingZeros"
|
||||
} else {
|
||||
this.plus(trailingZeros)
|
||||
return when {
|
||||
this.endsWith('0') -> this
|
||||
parsedDecimal?.scale() == 0 && trailingZeros.isNotEmpty() -> "$this$decimalSymbol$trailingZeros"
|
||||
else -> this.plus(trailingZeros)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue