Is there an easy way to do String normalization in...
# announcements
p
Is there an easy way to do String normalization in pure Kotlin (no JVM dependencies)? I am looking for something similar (or better identical) to the JavaScript String.prototype.normalize function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
h
https://docs.oracle.com/javase/tutorial/i18n/text/normalizerapi.html I found this for Java, not sure if this is what you need
p
Thanks, that would work for JVM. I would need it to be in 100% Kotlin though, so I can use it in Kotlin/Native
h
I'm gonna say it's gonna be pretty unlikely... Maybe you'll be lucky though. I am unsure
p
I thought so. Didn't know there exists a solution in Java though. Maybe I can use that and automatically convert it to Kotlin. Just have to figure out how the license works in such cases.
h
https://github.com/unicode-org/icu maybe take the icu4j implementation of normalization?
p
This looks promising, thanks. Very permissive license
h
👍
p
So just for reference, I decided to go with an expect/actual approach. For JVM I use the Java std lib, for Windows its the WIN32 normalize function and for js I use str.normalize