Skip to content

Commit

Permalink
update function toCalcBalanceAmount to make the right value (#3109)
Browse files Browse the repository at this point in the history
* update function toCalcBalanceAmount to make the right value

* fix detekt
  • Loading branch information
isaacnguyen0809 committed Apr 9, 2024
1 parent 1c7546b commit 156284a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ private fun formatShortenedNumber(
fun String.toCalcBalanceAmount(): Double {
val amountString = this.lowercase()
return when {
amountString.contains("k") -> amountString.replace("k", "000").toDouble()
amountString.contains("m") -> amountString.replace("m", "000000").toDouble()
amountString.contains("k") -> amountString.replace("k", "").toDouble() * THOUSAND
amountString.contains("m") -> amountString.replace("m", "").toDouble() * MILLION
else -> this.toDouble()
}
}
Expand Down

0 comments on commit 156284a

Please sign in to comment.