From b2196196e73478af7d6ef7c4672a85e9ba0783b2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 22 May 2024 18:51:03 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/core/ui/components/fields/AmountTextField.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt index 9db1abac3b..7c185e50d6 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt @@ -161,7 +161,7 @@ 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 when { - this.endsWith('0') -> this + this.endsWith('0') && parsedDecimal?.scale() != 0 -> this parsedDecimal?.scale() == 0 && trailingZeros.isNotEmpty() -> "$this$decimalSymbol$trailingZeros" else -> this.plus(trailingZeros) }