From: Martin Hart Date: 2004-02-12T10:41:49+09:00 Subject: Re: (noob) cast string to array? On Thursday 12 February 2004 01:34, David Naseby wrote: > >-----Original Message----- > > From: Koncept [mailto:user@unknown.invalid] > > >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. > > Avoid eval!!! I think that may be a bit harsh :-) As long as one is aware of when and when not to use it (the same as everything else) then it has a useful and valid purpose. Cheers, Martin