mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-30 13:52:58 -08:00
21 lines
598 B
Kotlin
21 lines
598 B
Kotlin
package com.kunzisoft.keepass.utils
|
|
|
|
import java.text.Normalizer
|
|
|
|
object StringUtil {
|
|
|
|
fun String.removeLineChars(): String {
|
|
return this.replace("[\\r|\\n|\\t|\\u00A0]+".toRegex(), "")
|
|
}
|
|
|
|
fun String.removeSpaceChars(): String {
|
|
return this.replace("[\\r|\\n|\\t|\\s|\\u00A0]+".toRegex(), "")
|
|
}
|
|
|
|
fun String.removeDiacriticalMarks(): String {
|
|
return "\\p{InCombiningDiacriticalMarks}+".toRegex()
|
|
.replace(Normalizer.normalize(this, Normalizer.Form.NFD), "")
|
|
}
|
|
|
|
fun ByteArray.toHexString() = joinToString("") { "%02X".format(it) }
|
|
} |