I am trying to split a string from a CSV on a method. There are two values seperated by one comma.
I use map to create a new List[(String, String)] but when I split, it returns an Array. If I use .toList immediately after the split(",") then it joins them back together, returning a List(String) which makes the split obsolete, and if I use .toList outside of the map, then it returns List[Array(String)].
When I use splitAt(2) it returns the correct datatype but it doesn't split at the comma. Is there a way for the split function to split into two Lists rather than Array?
EDIT: Code:
val getlines = some csv...
val splitList = getlines.map(_.split(",").toList) // returns List[List(String)]
val splitList = getlines.map(_.split(",")).toList // returns List[Array(String)]
val splitList = getlines.map(_.split(",")) // returns List[Array(String)]