how to break a "comma separated string" that contains "comma separated substrings"

Hi,

I a comma separated string that contains "comma separated substrings" like this:

str= ' "hello ,there" ,how,are ,you, "I am , fine" '

every substring that contains comma is in a " ".

I am trying to split str based on, so I should get something like:

"hello ,there" how are you "I am , fine"

tried many things like "split", ... didn't work.

any idea how to do this.

Thank you

Use the Ruby CSV class to parse it.