VOOZH about

URL: https://apidock.com/ruby/String/replace

⇱ String#replace - APIdock


method

replace

ruby latest stable - Class: String
replace(p1)
public

Replaces the contents and taintedness of str with the corresponding values in other_str.

s = "hello" #=> "hello"
s.replace "world" #=> "world"
VALUE
rb_str_replace(VALUE str, VALUE str2)
{
 str_modifiable(str);
 if (str == str2) return str;

 StringValue(str2);
 str_discard(str);
 return str_replace(str, str2);
}

Related methods