Split having double quotes enclosing split symbol

What is the best way to split a string based on , but if any string is in double quotes then ignore that ,

For eg:

Test, string, “ for, splitting”, in, scala

It must return for, splitting together as one string

Use a proper csv parser library like:


I want to emphatically second the reply by @BalmungSan .

Here are my many hours of personal background learning this harsh lesson posted as StackOverflow answers:

  1. parsing - What's a simple (Scala only) way to read in and then write out a small .csv file passing through a List[List[String]]? - Stack Overflow
  2. How do I read a large CSV file with Scala Stream class? - Stack Overflow

Thanks I used kantan lib

1 Like

Thanks for suggestion.
I used kantan lib.

1 Like