From 30b959a6da9e516cfb190554584b9a013c0412f7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 11 Nov 2023 11:42:54 +0100 Subject: Pablo Helper --- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 0900b3812..b60c08b6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -89,6 +89,15 @@ object StringUtils { } } + inline fun List.matchMatchers(text: String, consumer: Matcher.() -> T): T? { + for (pattern in iterator()) { + pattern.matchMatcher(text) { + return consumer() + } + } + return null + } + fun getColor(string: String, default: Int, darker: Boolean = true): Int { val stringPattern = "ยง[0123456789abcdef].*".toPattern() -- cgit