Michael de Kaste
11/09/2022, 10:48 AMfun main() {
println("%s %s".format("hi", "bye"))
println("%s %s".format(*arrayOf("hi", "bye")))
println("%s %s".format(arrayOf("hi", "bye"))) // java.util.MissingFormatArgumentException: Format specifier '%s'
}
Anyone know why it goes wrong with a pure array declaration?ephemient
11/09/2022, 10:54 AM.format(x)
doesn't change behavior based on whether x
is an array or notephemient
11/09/2022, 10:55 AMarrayOf(arrayOf("hi", "bye"))
(the outer array being generated by the compiler, same as in the first case)Michael de Kaste
11/09/2022, 11:01 AMRoukanken
11/09/2022, 11:05 AMprintln("%s %s".format(arrayOf("hi", "bye"), arrayOf("1", "2")))
and in what ways it is similar to your third case