Using Ruby convert numbers to words?

前端 未结 8 1375
广开言路
广开言路 2020-12-09 19:30

How to convert numbers to words in ruby?

I know there is a gem somewhere. Trying to implement it without a gem. I just need the numbers to words in English for integ

8条回答
  •  一向
    一向 (楼主)
    2020-12-09 19:57

    I can see what you're looking for, and you may wish to check out this StackOverflow post: Number to English Word Conversion Rails

    Here it is in summary:

    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:

    http://codesnippets.joyent.com/posts/show/447 http://raveendran.wordpress.com/2009/05/29/ruby-convert-number-to-english-word/ http://deveiate.org/projects/Linguistics/

提交回复
热议问题