Please see the example below. I create a multiline String and then try to split it. It works fine except the first line. By default split method doesn't return delimiters. So, I wonder what is so special about the beginning of the line that it returns "". And how to update the regex to avoid it.
scala> val Shakespear =
| """
| |To be,
| | or not
| |to be:
| """.stripMargin
Shakespear: String =
"
To be,
or not
to be:
"
scala> Shakespear.split("""[\s]+""")
res3: Array[String] = Array("", To, be,, or, not, to, be:)
Thanks.