Skip to content

rus4j/numbify

Repository files navigation

Numbify

EO

workflow codecov Maven Central Version LOC Hits-of-Code Codacy Badge

Numbify ia s Java library for transforming numbers into text with wide customization options.

Inspired by Ant1mas/number-to-words-ru

Usage

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.

Languages

  • 🇬🇧 English
  • 🇷🇺 Russian
  • more TBD

Data types

It supports any java numeric data types that are subclasses of Number

                               Number
 ┌──────┬───────┬───────┬─────┬──────┬─────────┬──────────┬─────────┐
 │      │       │       │     │      │         │          │
Byte  Short  Integer  Long  Float  Double  BigInteger  BigDecimal  ...

About

Library for transforming numbers into text.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages