Skip to content

Instantly share code, notes, and snippets.

@rrrene
Created July 19, 2010 21:17
Show Gist options
  • Save rrrene/482020 to your computer and use it in GitHub Desktop.
Save rrrene/482020 to your computer and use it in GitHub Desktop.
Replace european accents and umlauts with their simple counterparts
# Replace european accents and umlauts with their simple counterparts
# ä -> a, ç -> c, etc.
class String
def simplify
gsub(/[àáâãäåæ]/i, 'a').
gsub(/[ç]/i, 'c').
gsub(/[èéêë]/i, 'e').
gsub(/[ìíîï]/i, 'i').
gsub(/[ñ]/i, 'n').
gsub(/[òóôõöø]/i, 'o').
gsub(/[ùúûü]/i, 'u').
gsub(/[ýÿ]/i, 'y').
to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment