The number2words package provides several customization options to control the output format.
1️⃣ Change Letter Case
You can format the output in different cases using the wordCase parameter:
String result = Number2Words.convert(456, wordCase: WordCaseEnum.upperCase);
print(result); // Output: "FOUR HUNDRED FIFTY-SIX"
Available Options:
-
WordCaseEnum.lowerCase→"four hundred fifty-six" -
WordCaseEnum.upperCase→"FOUR HUNDRED FIFTY-SIX" -
WordCaseEnum.titleCase→"Four Hundred Fifty-Six"
2️⃣ Convert Decimal Numbers
Handles decimal numbers with precision:
String result = Number2Words.convert(789.99);
print(result); // Output: "Seven Hundred Eighty-Nine and Ninety-Nine Hundredths"
3️⃣ Multi-Language Support (If applicable)
If your package supports multiple languages, you can specify the output language:
String result = Number2Words.convert(2024, language: Number2WordsLanguage.french);
print(result); // Output: "Deux Mille Vingt-Quatre"
How to Contribute More Languages?
If you want to add a new language, check out the Contributing section for guidelines.
Explore the Examples section for more use cases! 🚀