In article
<XOCWb.33248$TPZ.8375 / twister01.bloor.is.net.cable.rogers.com>, Mike
Stok <mike / stok.co.uk> wrote:

> One thing that you might consider is that you have a line which looks
> like a CSV data record with { } adound it, so you could use a library
> from the Ruby Application Archive to mangle it after you've trimmed the
> { and }.

The {} is the result of issuing a command to AppleScript. This is the
way Applescript formats "Lists" or Arrays.

> 
> Alternatively, if the data is "well behaved", you can use a regular
> expression to pick it apart.  Using irb (interactive ruby to experiment:
> 
> >> result = '{ "robert", "trey", "adrian", "pat" }'
> => "{ \"robert\", \"trey\", \"adrian\", \"pat\" }"
> >> result.scan(/"(.*?)"/).flatten
> => ["robert", "trey", "adrian", "pat"]
>

Forgive me if I am missing something...

irb(main):001:0> result = '{ "robert","trey","adrian", "pat" }'
=> "{ \"robert\",\"trey\",\"adrian\", \"pat\" }"

irb(main):002:0> result.scan(/"(.*?)"/).flatten
=> ["robert", "trey", "adrian", "pat"]

irb(main):004:0> result.class
=> *String*

irb(main):005:0> result = ["robert","trey","adrian","pat"]
=> ["robert", "trey", "adrian", "pat"]

irb(main):006:0> result.class
=> *Array*

Your solution formatted my string to look like an Array, but the result
still has a class of String. :(

How can I cast this String as an Array?


> If you're familiar with regular expressions then they are well
> integrated into Ruby and can be powerful tools.  If you're not then
> there have been plenty of other suggestions which may fit your needs.
> 
> Hope this helps,
> 
> Mike

-- 
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