blob: 7d68afea6c9776a5fe15caee8f6f0144e50af73c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package at.hannibal2.skyhanni.utils
object StringUtils {
fun String.firstLetterUppercase(): String {
if (isEmpty()) return this
val lowercase = this.lowercase()
val first = lowercase[0].uppercase()
return first + lowercase.substring(1)
}
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
continue
}
builder.append(c)
}
return builder.toString()
}
// fun cleanColour(`in`: String): String? {
// return `in`.replace("(?i)\\u00A7.".toRegex(), "")
// }
}
|