This is the same problem as described in the link
How to convert a List to variable argument parameter java
But how to do it with scala ?
I have a string which contains comma separated values .
val s = "1.2.3.4,1.5.1.8,1.5.4.5,1.5.1.5"
I have converted to Array of String using
val as = s.split(",")
as: Array[String] = Array(1.2.3.4, 1.5.1.8, 1.5.4.5, 1.5.1.5)
The method expects a foo(String...param) which is actually a java method,but can be called from scala.
I tried foo(as)
. But It din't work.
(x$1: <repeated...>[String])foo
cannot be applied to (Array[String])
How to convert the array of string to variable argument parameter ?