diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-22 02:08:50 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-22 02:08:50 +0200 |
commit | ad946bccdb1dd666f2648434ed3653eaf0b137a1 (patch) | |
tree | 7ee383d55291c0042e6da91ff1c85433cf523509 /src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | |
parent | e8ae72d6b76ebee6eb5f3f37315d69e5a063926c (diff) | |
download | skyhanni-ad946bccdb1dd666f2648434ed3653eaf0b137a1.tar.gz skyhanni-ad946bccdb1dd666f2648434ed3653eaf0b137a1.tar.bz2 skyhanni-ad946bccdb1dd666f2648434ed3653eaf0b137a1.zip |
added support for books and essence to bazaar
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt | 7 |
1 files changed, 7 insertions, 0 deletions
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 |