Number to Words Conversion
ThenumberToWords utility converts numeric values into their Persian word equivalents with comprehensive support for ordinals, currency formatting, and various number scales.
Basic Usage
Simple Conversion
Advanced Options
The function accepts an optional configuration object for customized behavior:Ordinal Numbers
Generate ordinal numbers (first, second, third, etc.) in Persian:Currency Formatting
Format numbers as currency amounts:Number Scales
Choose between short and long scale representations:Supported Number Ranges
Range Support
- Minimum: 0 - Maximum: 999,999,999,999,999 (15 digits) - Decimals: Not supported (integers only) - Negative: Not supported (returns empty string)
Examples by Scale
Thousands
Millions
Billions and Beyond
Edge Cases
Zero and Invalid Input
Very Large Numbers
TypeScript Support
The utility provides full TypeScript support with proper type definitions:Performance Considerations
🚀 Optimization Tips
🚀 Optimization Tips
- Cache results for frequently used numbers
- Use tree-shaking to include only this utility
- Consider batch processing for large datasets
📊 Benchmarks
📊 Benchmarks
- Small numbers (1-999): ~0.1ms
- Medium numbers (1K-999K): ~0.2ms
- Large numbers (1M+): ~0.5ms
Common Use Cases
Invoice Generation
Educational Applications
Error Handling
The utility handles invalid input gracefully:Related Utilities
Words to Number
Convert Persian words back to numbers
Add Commas
Format numbers with thousands separators
Digit Conversion
Convert between Persian, Arabic, and English digits
Ordinal Suffix
Add or remove ordinal suffixes
