str = \"Hello☺ World☹\"
Expected output is:
\"Hello:) World:(\"
I can do this: str.gsub(\"☺\", \":)\").gsu
str.gsub(\"☺\", \":)\").gsu
Another simple way, and yet easy to read is the following:
str = '12 ene 2013' map = {'ene' => 'jan', 'abr'=>'apr', 'dic'=>'dec'} map.each {|k,v| str.sub!(k,v)} puts str # '12 jan 2013'