Ruby on Rails Friday, April 4, 2014



On Thursday, April 3, 2014 7:53:29 PM UTC-4, Ruby-Forum.com User wrote:
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

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

Use the Ruby CSV class to parse it.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d85cb545-9ce4-4ecb-83d4-2f0367cfc4e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment