Without comment:
scala> val in = "10 20 30 40 50"
in: String = 10 20 30 40 50
scala> (in split " ")
res0: Array[String] = Array(10, 20, 30, 40, 50)
scala> (in split " ") map (_.toInt)
res1: Array[Int] = Array(10, 20, 30, 40, 50)
With comment, I really want fscanf:
scala> val f"$i%d" = "10"
<console>:7: error: macro method f is not a case class, nor does it have an unapply/unapplySeq member
val f"$i%d" = "10"
^
But it occurs to me that for your use case, you want a simple syntax to scan for ints.
Without having to repeat myself:
scala> val r = """(\d+)""".r
r: scala.util.matching.Regex = (\d+)
scala> r findAllMatchIn in
res2: Iterator[scala.util.matching.Regex.Match] = non-empty iterator
scala> .toList
res3: List[scala.util.matching.Regex.Match] = List(10, 20, 30, 40, 50)
https://issues.scala-lang.org/browse/SI-8268