RUBY: Ruby on Rails - string replace
gsub
gsub() is the always very useful function in ruby.
You should be careful that the string variable should not have a nil value. Otherwise it will rise a nil exception.
gsub() is the always very useful function in ruby.
Syntax:
string.gsub("<search char>","<replace Char>")string.gsub(/'/,"") #replce/remove single quotes from the string
You should be careful that the string variable should not have a nil value. Otherwise it will rise a nil exception.
