From: Phrogz Date: 2007-11-02T05:15:02+09:00 Subject: Re: Sorting a string... On Nov 1, 2:00 pm, devi.webmas...@gmail.com wrote: > On 10/31/07, Brian Adkins wrote: > > > # splort for split sort ;) > > def splort s > > s.split('').sort!.join('') > > end > > The sort! is unnecessary, use sort (no exclamation) Based on what criterion/criteria? If there is a desire not to unnecessarily allocate an extra array, the exclamation point is necessary. You could say that the split() is unnecessary, because you can just do this instead: def splort s a = [] s.each_byte{ |b| a << b.chr } a.sort.join('') end