Sandro Paganotti
6/13/2008 8:08:00 AM
[Note: parts of this message were removed to make it a legal post.]
Try this:
irb(main):004:0> ex
=> {0=>["xls", "ini", "20080326"], 1=>["gif", "xls", "rb"]}
irb(main):005:0> ex = Hash[*ex.collect{|a,b| [a,b.join(",")]}.flatten]
=> {0=>"xls,ini,20080326", 1=>"gif,xls,rb"}
Sandro
On Fri, Jun 13, 2008 at 5:53 AM, Stefano Crocco <stefano.crocco@alice.it>
wrote:
> On Friday 13 June 2008, Clement Ow wrote:
> > Hi, I have 2 arrays(which is part of the hash):
> >
> > ex = {}
> > ex[0] = ["xls", "ini", "20080326"]
> > ex[1] = ["gif", "xls", "rb"]
> >
> > All i managed to convert is(using .to_s):
> > str[0] = "xlsini20080326"
> > str[1] = "gifxlsrb"
> >
> > but i want to convert each array into a string, something like
> > str[0] = "xls,ini,20080326"
> > str[1] = "gif,xls,rb"
> >
> > where they are seperated by a comma.. Any clean way of doin this?
>
> ex[0].join ','
>
> Stefano
>
>
>
--
Go outside! The graphics are amazing!