String # delete , of course, is not what you want, since it works with characters, not with the string as a whole.
Try
str.gsub /&/, ""
You can also try replacing &
to letter ampersand, for example:
str.gsub /&/, "&"
If this is closer to what you really want, you can get the best results without attaching an HTML string. If yes, try the following:
CGI::unescapeHTML(str)
Details of the unescapeHTML method are here .
source share