Skip to content

Commit

Permalink
added formatIntOrNull
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Oct 13, 2024
1 parent c5915be commit c31bef7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit c31bef7

Please sign in to comment.