diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-20 19:21:06 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-20 19:21:06 +0200 |
commit | e8ae72d6b76ebee6eb5f3f37315d69e5a063926c (patch) | |
tree | ada119390c86cb5f866f90f2d88b9e7d25eb822f /src/main/java | |
parent | 4e78fef420e82428bc1d0e2a733d3b6bd03601ff (diff) | |
download | skyhanni-e8ae72d6b76ebee6eb5f3f37315d69e5a063926c.tar.gz skyhanni-e8ae72d6b76ebee6eb5f3f37315d69e5a063926c.tar.bz2 skyhanni-e8ae72d6b76ebee6eb5f3f37315d69e5a063926c.zip |
i still cant regex
Diffstat (limited to 'src/main/java')
-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? { |