How to convert number to words in java

前端 未结 27 2820
遇见更好的自我
遇见更好的自我 2020-11-21 23:53

We currently have a crude mechanism to convert numbers to words (e.g. using a few static arrays) and based on the size of the number translating that into an english text. B

27条回答
  •  旧时难觅i
    2020-11-22 00:30

    Here is a very simple class NumberInWords.java that can have the job done very easily:

    String numberInWords = NumberInWords.convertNumberToWords(27546); //twenty seven thousand and five hundred forty six
    

    It's important to know that this class is only capable of converting int datatype.

提交回复
热议问题