aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-11-18 21:47:11 +0100
committerGitHub <noreply@github.com>2023-11-18 21:47:11 +0100
commite3a83c160bebdc06b7597b9a19d406468d4b1305 (patch)
tree0037caf25f1d41a50d1a419b6b07ce37a1be63e0 /src/main
parent68407ad32f772406b7cd9ccad64d9cd6b42bfae4 (diff)
downloadskyhanni-e3a83c160bebdc06b7597b9a19d406468d4b1305.tar.gz
skyhanni-e3a83c160bebdc06b7597b9a19d406468d4b1305.tar.bz2
skyhanni-e3a83c160bebdc06b7597b9a19d406468d4b1305.zip
updated formatnumber fun (#717)
Fixed formatNumber not working with upper case characters. #717
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index 707bb5b4d..bccf92e62 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -189,7 +189,7 @@ object NumberUtil {
}
fun String.formatNumber(): Long {
- var text = replace(",", "")
+ var text = lowercase().replace(",", "")
val multiplier = if (text.endsWith("k")) {
text = text.substring(0, text.length - 1)
@@ -197,7 +197,10 @@ object NumberUtil {
} else if (text.endsWith("m")) {
text = text.substring(0, text.length - 1)
1_000_000
- } else 1
+ }else if (text.endsWith("b")) {
+ text = text.substring(0, text.length - 1)
+ 1_000_000_000
+ }else 1
val d = text.toDouble()
return (d * multiplier).toLong()
}