Ruby 1.9.0 リファレンスマニュアル > ライブラリ一覧 > library _builtin > class String > replace

instance method String#replace

replace(other) -> String

self の内容を other の内容で置き換えます。

例:

str = "foo"
str.replace "bar"
p str   # => "bar"