Using Ruby convert numbers to words?

前端 未结 8 1367
广开言路
广开言路 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条回答
  •  -上瘾入骨i
    2020-12-09 20:15

    You can also use the to_words gem.

    This Gem converts integers into words.

    e.g.

    1.to_words # one ,
    
    100.to_words # one hundred ,
    
    101.to_words # one hundred and one
    

    It also converts negative numbers.

提交回复
热议问题