From 6b0e324c96073d824c12dff1629a782352155e99 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Thu, 30 May 2024 11:21:50 +0200 Subject: Feature: Hotm Features + Hotm API/Data (#1059) Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com> Co-authored-by: martimavocado <39881008+martimavocado@users.noreply.github.com> Co-authored-by: martimavocado Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt index f12ecdef6..927b08d54 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RegexUtils.kt @@ -49,4 +49,11 @@ object RegexUtils { fun Matcher.groupOrNull(groupName: String): String? = runCatching { this.group(groupName) }.getOrNull() fun Matcher.hasGroup(groupName: String): Boolean = groupOrNull(groupName) != null + + fun List.indexOfFirstMatch(pattern: Pattern): Int? { + for ((index, line) in this.withIndex()) { + pattern.matcher(line).let { if (it.matches()) return index } + } + return null + } } -- cgit