sixarm_ruby_unaccent
sixarm_ruby_unaccent copied to clipboard
SixArm.com » Ruby » Unaccent replaces a string's accented characters with ASCII characters.
SixArm.com → Ruby →
Unaccent gem
- Git: https://github.com/SixArm/sixarm_ruby_unaccent
- Doc: http://sixarm.com/sixarm_ruby_unaccent/doc
- Gem: https://rubygems.org/gems/sixarm_ruby_unaccent
- Contact: Joel Parker Henderson, [email protected]
- Project: changes, license, contributing.
Introduction
Replace a string's accent characters with ASCII characters.
Based on Perl Text::Unaccent from CPAN.
For docs go to http://sixarm.com/sixarm_ruby_unaccent/doc
Want to help? We're happy to get pull requests.
Install
Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_unaccent
Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_unaccent'
Require
To require the gem in your code:
require 'sixarm_ruby_unaccent'
Examples
French:
require "sixarm_ruby_unaccent"
str = "déjà vu";
str.unaccent => "deja vu";
Greek:
require "sixarm_ruby_unaccent"
str = "νέα" (aka "\x{03AD}\x{03BD}\x{03B1}")
str.unaccent => "νεα" (aka "\x{03B5}\x{03BD}\x{03B1}")