Numbify ia s Java library for transforming numbers into text with wide customization options.
Inspired by Ant1mas/number-to-words-ru
Add maven dependency into your project:
<dependency>
<groupId>org.rus4j</groupId>
<artifactId>numbify</artifactId>
<verion>2.3.0</verion>
</dependency>Gradle dependency:
implementation 'org.rus4j:numbify:2.3.0'The simplest example in English:
Numbify en = new NumbifyBuilder()
.english(Currency.USD)
.build();
String numberInText = en.toText(25.17); // "twenty five dollars seventeen cents"More complex example:
Numbify ru = new NumbifyBuilder()
.russian(RuDeclension.GENITIVE, Currency.NUMBER) // no specific currency in Genitive
.originalDecimal()
.capitalize()
.build();
String numberInText = en.toText(25.17); // "Двадцати пяти целых 17 сотых"Check full documentation and list of possible options on https://rus4j.org/numbify.
- 🇬🇧 English
- 🇷🇺 Russian
- more TBD
It supports any java numeric data types that are subclasses of Number
Number
┌──────┬───────┬───────┬─────┬──────┬─────────┬──────────┬─────────┐
│ │ │ │ │ │ │ │
Byte Short Integer Long Float Double BigInteger BigDecimal ...