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

On Thursday, April 3, 2014 7:53:29 PM UTC-4, Ruby-Forum.com User wrote:

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

Thank you


Posted via http://www.ruby-forum.com/.

Use the Ruby CSV class to parse it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs