From 0d1dc84d2224aeb8c0ba399057ea28f5bb291eaa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Wed, 24 Apr 2024 01:18:45 +0200 Subject: Fix: gfs error with 0 (#1528) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index d266e80ce..5df1915c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -173,9 +173,9 @@ object NumberUtil { private val numberPattern = "^[0-9]*$".toPattern() private val formatPattern = "^[0-9,.]*[kmb]?$".toPattern() - fun String.isInt(): Boolean { - return isNotEmpty() && numberPattern.matcher(this).matches() - } + fun String.isInt(): Boolean = isNotEmpty() && numberPattern.matcher(this).matches() + + fun String.isDouble(): Boolean = runCatching { toDouble() }.getOrNull() != null fun String.isFormatNumber(): Boolean { return isNotEmpty() && formatPattern.matches(this) -- cgit