From: Glenn Jackman Date: 2009-09-17T03:35:08+09:00 Subject: Re: string to array At 2009-09-16 02:03PM, "Re BR" wrote: > > Re BR wrote: > >> John W Higgins wrote: > >>> > >>>> x = "apple-orange-grape" > >>>> tmp = x.split('-') > >>> (0..tmp.length-1).map{ |i| tmp[i..-1].join('-') } > >> > >> trying to make this as a one liner [...] > a.split('-').map{ |i| a[i..-1].join('-') } Ugly, but: a = "apple-orange-banana" (tmp = a.split('-')).each_index.collect {|i| tmp[i..-1].join('-')} -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous