From ad946bccdb1dd666f2648434ed3653eaf0b137a1 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 22 Aug 2022 02:08:50 +0200 Subject: added support for books and essence to bazaar --- src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index 891826a91..1d4701397 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import java.text.NumberFormat import java.util.* +import java.util.regex.Pattern import kotlin.math.pow import kotlin.math.roundToInt @@ -149,4 +150,10 @@ object NumberUtil { lastDecimal + decimal } } + + val pattern = Pattern.compile("^[0-9]*$") + + fun String.isInt(): Boolean { + return isNotEmpty() && pattern.matcher(this).matches() + } } \ No newline at end of file -- cgit