On Thu, Oct 1, 2009 at 2:23 PM, George George <george.githinji / gmail.com> w=
rote:
> Given an array of strings e.g.
> =A0x =3D ["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 =3D ["abc","def"]
> x2 =3D ["abcde","xyzwj"]

You might want to look at group_by:

 %w{abc ads adfdf adfdw fefm mfekmw fmdms}.group_by {|x| x.length}

Jesus.