From: Stefano Crocco Date: 2008-06-16T17:44:45+09:00 Subject: Re: array to string conversion On Monday 16 June 2008, Clement Ow wrote: > Hi botp, > > Assuming I have my hash: > > ex = {} > ex[0] = [".xls", ".ini", "20080326"] > ex[1] = ["RVG", ".xls", ".rb"] > > The result i would want: > str1 = [".xls", ".ini", ".xls", ".rb"] > str2 = ["20080326", "RVG"] > > Is there any way i can do this? > Thanks. > > Regards, > Clement Try looking at Enumerable#partition. A possible way to do this is: res = ex.values.flatten.partition{|v| v[0..0] == '.'} p res => [[".xls", ".ini", ".xls", ".rb"], ["20080326", "RVG"]] Stefano