From: "Lorenzo E. Danielsson" Date: 2008-08-15T22:43:26+09:00 Subject: Re: Idiom of removing a particular character from a String? On Fri, 2008-08-15 at 11:56 +0900, David Masover wrote: > On Thursday 14 August 2008 11:59:51 Lorenzo E. Danielsson wrote: > > > So: > > str = "hello" > > rem = str.clone > > rem[2,1] = "" # => "helo" > > rem > > For what it's worth, I've been using Object#tap (1.8.7 or higher) in > situations like these: > > str = "hello" > str.clone.tap { |rem| > rem[2,1] = '' > } > > Ordinarily, I wouldn't mention it, but you were asking for idiomatic things, > and I like that idiom. Agreed, Object#tap looks very nice. Thanks for the info. Lorenzo