Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Stringクラス > replace

instance method String#replace

replace(other) -> String

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

例:

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