diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-05-16 00:12:00 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-15 16:12:00 +0200 |
commit | 068cc5db57af16b25dd5115498ddf0e6f1fc2c80 (patch) | |
tree | 494870e13da911e2679f1c6597c597ab18ba3a66 /src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | |
parent | 36752963503cc5657ddfb3e9318c78526d769bc4 (diff) | |
download | skyhanni-068cc5db57af16b25dd5115498ddf0e6f1fc2c80.tar.gz skyhanni-068cc5db57af16b25dd5115498ddf0e6f1fc2c80.tar.bz2 skyhanni-068cc5db57af16b25dd5115498ddf0e6f1fc2c80.zip |
Various Fixes (#107)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index cae0a5896..57c7b3b84 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -178,12 +178,8 @@ object NumberUtil { } fun String.formatNumber(): Long { - var hasDecimal = false var text = replace(",", "") - if (text.contains(".")) { - text = replace(".", "") - hasDecimal = true - } + val multiplier = if (text.endsWith("k")) { text = text.substring(0, text.length - 1) 1_000 @@ -191,8 +187,7 @@ object NumberUtil { text = text.substring(0, text.length - 1) 1_000_000 } else 1 - var d = text.toDouble() - if (hasDecimal) d /= 10 + val d = text.toDouble() return (d * multiplier).toLong() } }
\ No newline at end of file |