diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 18 |
1 files changed, 17 insertions, 1 deletions
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? { |