Str_replace PHP Function Equiv

I’ve been searching for ages and not come up with anything on the
internet. I was wondering if there is a Rails equiv. for the PHP
function str_replace. For example;

variable_for_new_string(“value_to_repace”, “string_to_replace_with”,

Thanks in advance for any help.


The ruby equiv of str_replace is gsub.


“Hello World”.gsub(“Hello”, “Bye”)


Thanks, i’ve managed to get my helper working correctly now.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs