diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-10-13 16:17:17 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-10-13 16:17:17 +0200 |
commit | c31bef70141a99e3202850a7bba1447e47993ea1 (patch) | |
tree | 7248217bbd45f6321d59ffe64e099adeb530647b | |
parent | c5915be522ccfb73feed69b8d0fa1b45420e78e3 (diff) | |
download | skyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.tar.gz skyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.tar.bz2 skyhanni-c31bef70141a99e3202850a7bba1447e47993ea1.zip |
added formatIntOrNull
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 4 |
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")) { |