Make the room filter use normalized strings.

This commit is contained in:
Benoit Marty
2024-12-16 16:18:15 +01:00
parent 4bb860f9af
commit 6ef9db1bdb
4 changed files with 32 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
package io.element.android.libraries.core.extensions
import java.text.Normalizer
import java.util.Locale
fun Boolean.toOnOff() = if (this) "ON" else "OFF"
@@ -83,3 +84,8 @@ fun String.safeCapitalize(): String {
}
}
}
fun String.withoutAccents(): String {
return Normalizer.normalize(this, Normalizer.Form.NFD)
.replace("\\p{Mn}+".toRegex(), "")
}