number_format
Format a numeric value using localization settings.
If use_l10n is provided and is not None, it forces the value to be localized (or not), otherwise it's always localized.
def number_format(
value: number|string,
decimal_pos: int = None,
use_l10n: boolean = None,
force_grouping: boolean = False
) - > string
Format a numeric value using localization settings. If use_l10n is provided and is not None, it forces the value to be localized (or not), otherwise it's always localized.
Parameters
| Name | Type | Description |
|---|---|---|
| value | `number | string` |
| decimal_pos | int = None | The number of decimal places to display in the formatted output. |
| use_l10n | boolean = None | A flag to explicitly enable or disable localization; defaults to True if not provided. |
| force_grouping | boolean = False | Whether to force the use of digit grouping separators regardless of the current locale's default settings. |
Returns
| Type | Description |
|---|---|
string | The formatted numeric string with appropriate separators and decimal precision based on the specified locale settings. |