Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

translit string (americanize)

   1  
   2  require 'iconv'
   3  
   4  class String
   5    def translit
   6      self.gsub(/[^\x20-\x7f]/){ Iconv.iconv('us-ascii//IGNORE//TRANSLIT', 'utf-8',$&)[0].sub(/^[\^`'"~](?=[a-z])/i, '')}
   7    end
   8  end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS