From: William James Date: 2008-03-09T04:49:57+09:00 Subject: Re: duplicating characters in a string On Mar 6, 10:12 am, Adam Akhtar wrote: > If i have a string "abc" and want to make it like this "aabbcc", how do > i go about it? > > I thought convert it into an array and then use string.map{|x| x << x} > > though i havnt tested that yet. Is there a better way or a string method > that saves me from having to convert it into an array? > -- > Posted viahttp://www.ruby-forum.com/. s = "aabbcc" ==>"aabbcc" s = s.squeeze ==>"abc" s = s.unsqueeze ==>"aabbcc" Yes, that should have been saved till April 1.