The number to format
Configuration options
Which language to output
The separator character
The decimal separator character
Number of digits per group
The formatted number as a string with separators
toGrouped(1000000) // "1,000,000"
toGrouped(1234.56) // "1,234.56"
toGrouped(1000000, {separator: '.'}) // "1.000.000" (European format)
toGrouped(1000000, {separator: ' ', locale: 'ar'}) // "١ ٠٠٠ ٠٠٠"
toGrouped(12345678, {segment: 4}) // "1234,5678" (custom grouping)
toGrouped(12345678, {segment: [3, 2]}) // "1,23,45,678" (Indian numbering)
Formats a number with digit grouping separators for better readability.