From your code snippet, you don’t seem to handle double quotes in CSV (RFC-4180).
It’s just my opinion but I think you should use a CSV library like scala-csv or a Java CSV lib like commons-csv as your starting point. If you think enhancements can be made to the underlying CSV lib then you can submit them as Pull Requests or fork the project.