How to get String Codepoints in Multiplatform

Since I can’t use the String functions in Java,
I can’t find any function can deal with String codepoints in Kotlin common.
Any suggestion?

4 Likes

AFAIK there is currently no library that does that. There is an open issue for this here but it’s currently not added to the std-lib since it would drastically increase the size of the library on JS.
Some other relevant issues are:

Those are the once I know of, might have missed a few.

Right now the best approach is to write your own small wrapper library that calls into platform specific implementations of unicode. On the JVM side you can just use the java api and I’m sure there are libraries out there for JS and/or native (using C)

4 Likes

As @Wasabi375 mentioned, there is no standard library for it. I implemented it myself for the JVM, native and JS in my project. You’re welcome to use that code.

The entry points are defined here: array/charsets.kt at master · lokedhs/array · GitHub

You can find the implementations in the respective modules.

4 Likes