diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index a9ac0ca82..9ac80f7f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -38,6 +38,12 @@ object StringUtils { private val formattingChars by lazy { "kmolnr".toCharArray() + "kmolnr".uppercase().toCharArray() } + /** + * Removes color and optionally formatting codes from the given string, leaving plain text. + * + * @param keepFormatting Boolean indicating whether to retain non-color formatting codes (default: false). + * @return A string with color codes removed (and optionally formatting codes if specified). + */ fun String.removeColor(keepFormatting: Boolean = false): String { val builder = StringBuilder(this.length) |