Skip to content
instance method

String#initialize_copy

(::string other_string) -> self
initialize_copy(p1)

Alias of #replace

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 #replace #index #insert #include? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0