What is the most efficient way to convert numeric amount into English words
e.g. 12 to twelve 127 to one hundred twenty-seven
What is the most efficient way to convert numeric amount into English words
e.g. 12 to twelve 127 to one hundred twenty-seven
Note some rules:
digit place
like "three thousand".You can get the place of a number by using floor division of integers: 532 / 100 -> 5
This is part of Common Lisp!
Here's how GNU CLISP does it, and here's how CMUCL does it (easier to read, IMHO).
Doing a code search for "format million billion" will turn up lots of them.
This is some old python code on my hard drive. There might be bugs but it should show the basic idea: