From: Paul Smith Date: 2009-10-01T21:39:42+09:00 Subject: Re: how do you do this 2009/10/1 Jesús Gabriel y Galán : > On Thu, Oct 1, 2009 at 2:23 PM, George George wrote: >> Given an array of strings e.g. >>  x = ["abc","abcde" "def","xyzwj"] and of different lengths, >> how can you efficiently create new arrays of strings which are of the >> same length. for example the above array can be transformed into >> >> x1 = ["abc","def"] >> x2 = ["abcde","xyzwj"] > > You might want to look at group_by: > >  %w{abc ads adfdf adfdw fefm mfekmw fmdms}.group_by {|x| x.length} I really can't believe Ruby sometimes. This is so freaking awesome! Must get back to real work... -- Paul Smith http://www.nomadicfun.co.uk paul@pollyandpaul.co.uk