I have hex string (bytes), and i need convert to n...
# kotlin-native
k
I have hex string (bytes), and i need convert to normal string. Is it something like data.toByteArray().contentToString() ?
m
From INTEROP.md:
val path = getenv("PATH")?.toKString() ?: ""
k
@msink your answer leaked to other thread 😉
k
Do you mean, that there is no available implementation or library for that?
o
ByteArray.stringFromUtf8
does what you ask for
k
hm... this method is not available to me
o
import
kotlin.text
package
k
I have gradle project with compile "org.jetbrains.kotlinkotlin stdlib1.2.30". I could use StringBuilder and ByteArray in project. This method is not available. Even if i explicitly add "import kotlin.text.*" in source file
i don't see any method in these classes that have "utf" in it
o
this method is Kotlin/Native specific
k
Do I understood correctly, that there is no generic method, that could be used in "common" kotlin code, that will be them compiled to each platform?
I want to do something like "String(myByteArray)", which works on jvm, but not in iOS
o
yes, but nobody prevents you from writing one using MPP
k
ok, thx 🙂
d
@Konstantin Petrukhnov if you need a MPP function for that, to use before String<->ByteArray conversions are avaialble for MPP, you can use (copy-paste and adjust as needed) this one in the meantime: https://github.com/soywiz/start-ktor-io-proposal/blob/master/src/io/ktor/start/util/charset.kt https://github.com/soywiz/start-ktor-io-proposal/blob/master/src/io/ktor/start/util/baos.kt
p
Ran into that as well. Is there a roadmap which functions will be implemented for iOS in the future? Can I expect to get all functions on iOS which are currently supported by jvm?