Plugin: NumbersToWords


In my RAILS application I need to convert numbers to words. I started writing own function but before I finish that I got an amazing Plugin.

This Plugin is capable to convert number to words.
Following are some examples

>> 5.to_english
=> “five”
>> 123456.to_english
=> “one hundred twenty-three thousand four hundred and fifty-six”
>> 2.5.to_english
=> “two”
>> (2.5).to_english
=> “two”
>> (2.5).to_dollars
=> “two dollars and fifty cents”
>> 5.to_japanese
=> “go”
>> (2.5).to_japanese
=> “ni”

install this plugin by :
script/plugin install http://svn.recentrambles.com/plugins/numbersToWords

Sponsors

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
Rails: Issuing direct query to database
Ajax Scaffold Generator
If my code or post helps you then please recommend me at workingwithrails.com by clicking on button below:
Recommend Me

Reader Comments

Hi!

I just added a spanish module to your plug-in, where can I send you the patch?

btw, the module behaves weird with really big numbers…… but it is related to the limited precision of the Float class.

c-ya!

Ildefonso Camargo

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.