Sha256: 65f4d5b623ddeb569bafd0c4e8087059455e761c63d2d28494989d8a42e8d4ba
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
module AccentBuster::StringExtension refine String do # Convert diacritics chars to their non-diacritic equivalents. # # Works for latin languages only. # # Returns a copy of the string with diacritics removed. def accent_buster self.tr('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC') end # Convert diacritics chars to their non-diacritic equivalents. # # Works for latin languages only. # # Convert the string in place. # # Returns the string or nil if no changes were made. def accent_buster! self.tr!('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
accent-buster-1.0.0 | lib/accent-buster/string_extension.rb |