Reputation: 214927
I am trying to parse a csv file where some of the lines may have missing fields, and I found this strange behavior:
scala> val s = "1,2,,,"
s: String = 1,2,,,
scala> s.split(",")
res4: Array[String] = Array(1, 2)
While I am expecting the result to be Array(1,2,"","","")
. Am I missing something? If not, what is the justification of this behavior?
Upvotes: 5
Views: 676