The number2words package offers a range of features designed to make number-to-word conversion simple and flexible. Here's a comprehensive list of the core features:
1️⃣ Basic Number Conversion
Easily convert any integer into its word representation.
Number2Words.convert(123); // Output: "One Hundred Twenty-Three"
2️⃣ Decimal Conversion
Convert decimal numbers with precision, correctly handling both the whole number and fractional parts.
Number2Words.convert(45.78); // Output: "Forty-Five and Seventy-Eight Hundredths"
3️⃣ Letter Case Customization
Customize the output case to fit your use case, including uppercase, lowercase, and title case.
Number2Words.convert(256, wordCase: WordCaseEnum.upperCase); // Output: "TWO HUNDRED FIFTY-SIX"
4️⃣ Multi-Language Support
Support for multiple languages to convert numbers into words in different languages (English, Spanish, French, etc.).
Number2Words.convert(2024, language: Number2WordsLanguage.french); // Output: "Deux Mille Vingt-Quatre"
5️⃣ Large Number Support
Handle large numbers (up to 12 digits), making the package suitable for use cases like invoices and financial documents.
Number2Words.convert(987654321); // Output: "Nine Hundred Eighty-Seven Million Six Hundred Fifty-Four Thousand Three Hundred Twenty-One"
6️⃣ Grammatical Accuracy
Ensures proper grammar for conjunctions, singular/plural forms, and formatting for a natural flow of words.
7️⃣ Extensible
The package is designed to be easily extended with additional features like more languages or customization options. Contributions are welcome!
8️⃣ Lightweight & Fast
Optimized for performance, ensuring fast and efficient conversions without unnecessary overhead.
These features ensure that number2words is versatile, efficient, and customizable to fit a variety of use cases. 🚀
🔗 Next: Check out the Customization Options section to learn how to adjust the output.