From: Koncept Date: 2004-02-12T10:30:00+09:00 Subject: Re: (noob) cast string to array? In article <200402120054.23296.martin@zsdfherg.com>, Martin Hart wrote: > irb(main):002:0> s = '["a string", "another string"]' > => "[\"a string\", \"another string\"]" > irb(main):003:0> array = eval s > => ["a string", "another string"] > irb(main):004:0> array.class > => Array This is great! Thanks Martin. Thanks for all the fast responses as well everybody. I just wanted to follow up on some of the responses here: 1) Suggestion to use gsub over sub. I assume that gsub is global? 2) what is the "!" responsible for doing? (Remember me = n00b ) > Simon wrote: > result.sub!(/\{/,'[').sub!(/\}/,']') -- Koncept << "Contrary to popular belief, the most dangerous animal is not the lion or tiger or even the elephant. The most dangerous animal is a shark riding on an elephant, just trampling and eating everything they see." - Jack Handey