Logan Capaldo wrote:
> On Feb 8, 2006, at 9:27 PM, David Vallner wrote:
>>
>> Now if only we directly had a method to slice an Array into an  
>> Array of
>> slices, the whole thing could turn into a one-liner. Which I hate,  
>> but in a
>> good way.
>>
>> David Vallner
>>
> 
> str.split(//).reverse.to_enum(:each_slice,3).to_a

The one above from Logan didn't work for me.

But this one from James Edward Gray II did:
str.reverse.gsub(/(\d\d\d)(?=\d)(?!\d*\.)/,'\1,').reverse

Thanks to both.
-- 
Posted via http://www.ruby-forum.com/.