aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
index bede93187..a937b6f12 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
@@ -91,9 +91,7 @@ object StringUtils {
return cleanedString.toString()
}
- fun UUID.toDashlessUUID(): String {
- return toString().replace("-", "")
- }
+ fun UUID.toDashlessUUID(): String = toString().replace("-", "")
inline fun <T> Pattern.matchMatcher(text: String, consumer: Matcher.() -> T) =
matcher(text).let { if (it.matches()) consumer(it) else null }
@@ -260,15 +258,9 @@ object StringUtils {
return chatComponent
}
- fun String.getPlayerNameFromChatMessage(): String? {
- val matcher = matchPlayerChatMessage(this) ?: return null
- return matcher.group("username")
- }
+ fun String.getPlayerNameFromChatMessage(): String? = matchPlayerChatMessage(this)?.group("username")
- fun String.getPlayerNameAndRankFromChatMessage(): String? {
- val matcher = matchPlayerChatMessage(this) ?: return null
- return matcher.group("rankedName")
- }
+ fun String.getPlayerNameAndRankFromChatMessage(): String? = matchPlayerChatMessage(this)?.group("rankedName")
private fun matchPlayerChatMessage(string: String): Matcher? {
var username = ""
@@ -304,10 +296,7 @@ object StringUtils {
fun String?.equalsIgnoreColor(string: String?) = this?.let { it.removeColor() == string?.removeColor() } ?: false
- fun String.isRoman(): Boolean {
- return UtilsPatterns.isRomanPattern.matches(this)
- }
- fun isEmpty(message: String): Boolean {
- return message.removeColor().trimWhiteSpaceAndResets().isEmpty()
- }
+ fun String.isRoman(): Boolean = UtilsPatterns.isRomanPattern.matches(this)
+
+ fun isEmpty(message: String): Boolean = message.removeColor().trimWhiteSpaceAndResets().isEmpty()
}