Text to Hash

Shaun Gish
Sun, 23 Mar 2014 19:52:06 -0000

I'm trying to parse some text to break into a Hash with Key Value pairs.

The text looks like this:

"Business Services","$2,480.31"
"Shopping","$1,914.75"
"Home","$1,807.53"

Each string is the key, each dollar amount is the associated value.

How would I break this apart?

(I've tried using split to break the text up on \r\n and , but I can't
seem
to get the key value association part).

Thanks

--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/7af593b5-fdf0-4fd2-ad10-3de00017aaa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.