As a workaround, There is a Kotlin stdlib function that can be used in a nice way and fully compatible with Java's String format (it's only a wrapper around Java's String.format()
)
See Kotlin's documentation
Your code would be:
val pi = 3.14159265358979323
val s = "pi = %.2f".format(pi)