views:

25

answers:

1

Hi,

Anybody knows the method to convert the numericals to english number words in rails?

I found some Ruby scripts to convert numbericals to english words for corresponding words.

Instead of writing a script in ruby, i feel that direct function is available.

Eg. 1 -> One, 2 -> Two.

+3  A: 

No, you have to write a function yourself. The closest thing to what you want is number_to_human, but that does not convert 1 to One.

Here are some URLs that may be helpful:

captaintokyo
You know any available script for that?
Palani Kannan
No... why don't you use the Ruby scripts you found?
captaintokyo
I found a few URLs for you. Good luck.
captaintokyo
@captaintokyo: I found one patch.http://dev.rubyonrails.org/attachment/ticket/5404/number_helper_number_to_words.2.patch But, I m struggling it to implement this patch.... Thts what I tried for a straight function. Whether you know about this patch? or patching method for rails?
Palani Kannan
@captaintokyo: Linguistics gem have function "en.numwords"... Loads of thanks to you. it works!!!!
Palani Kannan
You are welcome. Glad you got it working :-)
captaintokyo