Method to strip linefeeds

Hi - I imagine there is some easy method but I just can’t find it. I
want to take a string that has \r\n’s in it and replace them with a
space. Anyone know if this is built in?

thanks,
dino

this is a way
use regular expression

string = " this \r is \n text"

new_string = string.gsub(/\n|\r/, " ")

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