The following code:

val sentence = "1 2  3   4".split(" ")

gives me:

Array(1, 2, "", 3, "", "", 4)

but I'd rather want to have only the words:

Array(1, 2, 3, 4)

How can I split the sentence when the words are separated by multiple spaces?

Edit
Report