HumanNumber
Convert numbers into English-spoken strings
Download HumanNumber.java
The HumanNumber class provides a few static methods that turn numerical numbers into English-spoken strings.
Examples of Use
// Format some ints or longs. String result = HumanNumber.format(0); result = HumanNumber.format(1); result = HumanNumber.format(12); result = HumanNumber.format(123); result = HumanNumber.format(1234); // Format a String (allows longer numbers to be formatted) result = HumanNumber.format("645635467684453453463455435");
The above examples return the following:
- zero
- one
- twelve
- one hundred and twenty three
- one thousand, two hundred and thirty four
- six hundred and forty five septillion, six hundred and thirty five sextillion, four hundred and sixty seven quintillion, six hundred and eighty four quadrillion, four hundred and fifty three trillion, four hundred and fifty three billion, four hundred and sixty three million, four hundred and fifty five thousand, four hundred and thirty five
This class supports positive integers up to approximately 1065.
Licensing
This software product is OSI Certified Open Source Software, available under the GNU General Public License (GPL). Since the GPL may be too restrictive for use in proprietary applications, a commercial license is also provided.
Purchase a commercial license for this software.
Search this site
Copyright Paul Mutton 2001-2013
http://www.jibble.org/
Feedback welcomed