I am working with strings encoding tables of data:
var table =
"""1 2 3
4 5 6
7 8 9"""
I can see that in the Scala worksheet this is evaluated to:
table: String =
1 2 3 //1
4 5 6 //2
7 8 9
When I try to split the values by newline and space characters:
table.split("\n").map(_.split("\\s+"))
The extra characters are present:
res25: Array[Array[String]] = Array(Array(1, 2, 3, //1), Array(4, 5, 6, //2), Array(7, 8, 9))
What is the reason of those characters being there?