java – Formatting a currency amount from digital to string using different currencies

Question:

Good day!

Is there a ready-made solution for converting digital monetary representation into string for different currencies in Russian?

For instance:

123.4 = one hundred twenty three rubles 40 kopecks

123.4 = one hundred twenty three euros 40 euro cents

123.4 = one hundred twenty three dollars and 40 cents

123.4 = one hundred twenty-three francs and 40 sous

And also for other currencies.

I would be glad for any help!

Answer:

There is a ready-made library for converting an amount into a string moneytostr-russian .

Connection:

<dependency>
    <groupId>com.github.javadev</groupId>
    <artifactId>moneytostr</artifactId>
    <version>1.17</version>
</dependency>

Usage:

MoneyToStr moneyToStr = new MoneyToStr(MoneyToStr.Currency.RUR, MoneyToStr.Language.RUS, MoneyToStr.Pennies.NUMBER);
moneyToStr.convert(123.4D)

// сто двадцать три рубля 40 копеек
Scroll to Top