@@ -38,6 +38,7 @@ dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.tinypinyin)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.bundles.androidx.lifecycle)
|
||||
|
||||
|
||||
@@ -1,7 +1,25 @@
|
||||
package de.mm20.launcher2.ktx
|
||||
|
||||
import com.github.promeg.pinyinhelper.Pinyin
|
||||
import java.net.URLDecoder
|
||||
import java.util.*
|
||||
|
||||
fun String.decodeUrl(charset: String): String? {
|
||||
return URLDecoder.decode(this, charset)
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a string to lowercase ASCII
|
||||
* TODO: Only supports Chinese/Pinyin at the moment
|
||||
*/
|
||||
fun String.normalize(): String {
|
||||
return this.romanize().lowercase(Locale.getDefault())
|
||||
}
|
||||
|
||||
/**
|
||||
* Romanize a string, transliterate non-latin characters into latin
|
||||
* TODO: Only supports Chinese/Pinyin at the moment
|
||||
*/
|
||||
fun String.romanize(): String {
|
||||
return Pinyin.toPinyin(this, "")
|
||||
}
|
||||
Reference in New Issue
Block a user