Social Media
More About This Website

My name is Wayne Robinson and I'm a web applications developer from Queensland, Australia. In August 2005 I discovered Ruby on Rails and instantly fell in love. From that point forward, Ruby on Rails has been my language of choice for new projects however, I still use PHP to maintain some legacy applications.

« Stop printing document properties summary page in Word 2007 | Main | Planners hope to transform super industry »

Dealing with codes - phonetic_alphabet plugin (Ruby on Rails)

Most fonts are designed for readability of words, not complicated codes and recently, we've had to provide referreral codes to our partners so that we can track the applications that come from them. Instead of sufferring through referral codes being incorrectly provided because someone has confused an O for an 0 or a 1 for a l or even an I (see what I mean!), I created a plugin that turns any string into it's spoken version using the NATO phonetic alphabet.

To install this plugin in Ruby on Rails, just type the following from your application's root directory:

script/plugin install _

To use, see this except from the README file:

You can get the phonetic equivalent of a single character with PhoneticAlphabet[single_character]


You can convert a string to it's phonetic equivalent using the String#to_phonetic overridden method.


    puts "hello world".to_phonetic


    hotel echo lima lima oscar SPACE whiskey oscar romeo lima delta

You can also pass in a different separator:


    puts "hello world".to_phonetic("-")



PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Hyperlinks will be created for URLs automatically.