From: Mage Date: 2008-08-07T04:18:31+09:00 Subject: Re: hash from string Tim Pease wrote: > str = ' "gaz"=>"1", "viz"=>"1", "lift"=>"0", "kamra"=>"1", "klima"=>"0" ' > > h = {} > str.split(',').each do |substr| > ary = substr.strip.split('=>') > h[ary.first.tr('"','')] = ary.last.tr('"','') > end > > > But that won't handle nested values -- that's left for someone else > with more time than me. Won't even work if any of the values contains a comma. Mage