Hi --

On Tue, 28 Mar 2006, karl_brodowsky / yahoo.com wrote:

> It would make sense to have a pair replace and replace!.
> For example for Strings, it could be imagined such methods myreplace
> and myreplace!:
> a="abcd"
> b=a.myreplace('a', 'b')
> puts(a) # => "abcd"
> puts(b) # => "bbcd"
> b=a.myreplace!('a', 'c')
> puts(a) # => "cbcd"
> puts(b) # => "cbcd"

That's not what replace does, though.  See sub and sub!


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black