aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-10-13 16:17:17 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-10-13 16:17:17 +0200
commitc31bef70141a99e3202850a7bba1447e47993ea1 (patch)
tree7248217bbd45f6321d59ffe64e099adeb530647b /src/main/java/at/hannibal2/skyhanni
parentc5915be522ccfb73feed69b8d0fa1b45420e78e3 (diff)
downloadskyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.tar.gz
skyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.tar.bz2
skyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.zip
added formatIntOrNull
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index dc7c4828c..b05275151 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -241,7 +241,9 @@ object NumberUtil {
return@run null
}
- private fun String.formatDoubleOrNull(): Double? {
+ fun String.formatIntOrNull(): Int? = formatDoubleOrNull()?.toInt()
+
+ fun String.formatDoubleOrNull(): Double? {
var text = lowercase().replace(",", "")
val multiplier = if (text.endsWith("k")) {