Skip to content
instance method

String#replace

(::string other_string) -> self
replace(other_string) → self

Replaces the contents of self with the contents of other_string; returns self:

Example
s = 'foo'        # => "foo"
s.replace('bar') # => "bar"

Related: see Modifying.

See also #prepend #reverse #partition #reverse! also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0