From e8ae72d6b76ebee6eb5f3f37315d69e5a063926c Mon Sep 17 00:00:00 2001 From: Lorenz Date: Sat, 20 Aug 2022 19:21:06 +0200 Subject: i still cant regex --- .../java/at/hannibal2/skyhanni/utils/StringUtils.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index a28f6fd2e..7d68afea6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -11,7 +11,23 @@ object StringUtils { } fun String.removeColor(): String { - return replace("(?i)\\u00A7.", "") +// return replace("(?i)\\u00A7.", "") + + val builder = StringBuilder() + var skipNext = false + for (c in this.toCharArray()) { + if (c == 'ยง') { + skipNext = true + continue + } + if (skipNext) { + skipNext = false + continue + } + builder.append(c) + } + + return builder.toString() } // fun cleanColour(`in`: String): String? { -- cgit