Skip to content

Instantly share code, notes, and snippets.

@ericsaboia
Created October 5, 2011 20:31
Show Gist options
  • Save ericsaboia/1265611 to your computer and use it in GitHub Desktop.
Save ericsaboia/1265611 to your computer and use it in GitHub Desktop.
Function to make accents insensitives
@@accents = ["(a|á|à|â|ã)","(e|é|è|ê)","(i|í|ì)","(o|ó|ò|ô|õ)","(u|ú|ù)","(c|ç)"]
def accent_insensitive
str = String.new(self)
@@accents.each {|exp| str.gsub! Regexp.new(exp), exp}
str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment