str = \"Hello☺ World☹\"
Expected output is:
\"Hello:) World:(\"
I can do this: str.gsub(\"☺\", \":)\").gsu
str.gsub(\"☺\", \":)\").gsu
Late to the party but if you wanted to replace certain chars with one, you could use a regex
string_to_replace.gsub(/_|,| /, '-')
In this example, gsub is replacing underscores(_), commas (,) or ( ) with a dash (-)