diff options
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, 8 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 b97298ce4..4d5fe0a1d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -1,14 +1,18 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RegexUtils.matches import java.text.NumberFormat +import java.util.Locale import java.util.TreeMap import kotlin.math.pow import kotlin.math.roundToInt object NumberUtil { + private val config get() = SkyHanniMod.feature + private val suffixes = TreeMap<Long, String>().apply { this[1000L] = "k" this[1000000L] = "M" @@ -109,7 +113,10 @@ object NumberUtil { return this.toString() + this.ordinal() } - fun Number.addSeparators() = NumberFormat.getNumberInstance().format(this) + fun Number.addSeparators(): String { + return if (!config.dev.numberFormatOverride) NumberFormat.getNumberInstance().format(this) + else NumberFormat.getNumberInstance(Locale.US).format(this) + } fun String.romanToDecimalIfNecessary() = toIntOrNull() ?: romanToDecimal() |