Pass Array<String> as vararg parameter

Hi guys,

There is a method in gava which accept one parameter as String…  args. I am trying to pass there app args which is Array<String> but code analyzer telling me what i cannot  do that. How i can transform args to be able to do that?

Thanks

Use spread operator, see example from M2 release notes. Unfortunately, it is not described in main Koltin docs.

fun printAll(vararg a : String) {   for (item in a) println(item) } fun main(args: Array<String>) {   printAll("one", "two")   printAll(*args) }
1 Like

Thanks. We'll add it. Logged here:

http://youtrack.jetbrains.com/issue/KT-5499

Thaks! Did not tryied yet, but looks straightforward.