aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt2
1 files changed, 2 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 1057b5c0a..59b82cd8c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
@@ -20,11 +20,13 @@ object StringUtils {
private val resetPattern = "(?i)§R".toPattern()
private val sFormattingPattern = "(?i)§S".toPattern()
private val stringColourPattern = "§[0123456789abcdef].*".toPattern()
+ private val asciiPattern = "[^\\x00-\\x7F]".toPattern()
fun String.trimWhiteSpaceAndResets(): String = whiteSpaceResetPattern.matcher(this).replaceAll("")
fun String.trimWhiteSpace(): String = whiteSpacePattern.matcher(this).replaceAll("")
fun String.removeResets(): String = resetPattern.matcher(this).replaceAll("")
fun String.removeSFormattingCode(): String = sFormattingPattern.matcher(this).replaceAll("")
+ fun String.removeNonAscii(): String = asciiPattern.matcher(this).replaceAll("")
fun String.firstLetterUppercase(): String {
if (isEmpty()) return this