aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
index 8150bce4f..7a7eeeb60 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
@@ -19,20 +19,17 @@ object StringUtils {
}
fun String.removeColor(): String {
-// return replace("(?i)\\u00A7.", "")
-
val builder = StringBuilder()
- var skipNext = false
- for (c in this.toCharArray()) {
- if (c == '§') {
- skipNext = true
- continue
- }
- if (skipNext) {
- skipNext = false
+
+ var counter = 0
+ while (counter < this.length) {
+ if (this[counter] == '§') {
+ counter += 2
continue
+ } else {
+ builder.append(this[counter])
+ counter++
}
- builder.append(c)
}
return builder.toString()