https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
c

Carl Hickman

03/16/2023, 2:32 PM
What would be the Kotlin Native way to do what the Java based String.format does?
l

Landry Norris

03/16/2023, 2:33 PM
The default cinterop setup allow you to use snprintf.
e

ephemient

03/16/2023, 4:59 PM
you may want to keep an eye on https://youtrack.jetbrains.com/issue/KT-25506
there's differences between Java's String.format and C's printf family of functions
snprintf, in particular, requires you to pre-allocate a buffer (although on sme platforms you can make one pass first with a null buffer to measure the size required)
8 Views