Created
July 19, 2010 21:17
-
-
Save rrrene/482020 to your computer and use it in GitHub Desktop.
Replace european accents and umlauts with their simple counterparts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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