Home > utils > formatNumber
格式化数字。
Signature:
export declare function formatNumber(value: number, options?: FormatNumberOptions): string;
Parameter | Type | Description |
---|---|---|
value | number | 要格式化的数字 |
options | FormatNumberOptions | 选项 |
Returns:
string
返回格式化后的数值
formatNumber(1314.56789) // => '1,314.56789'
formatNumber(1314.56789, { thousandsSeparator: ' ' }) // => '1 314.56789'
formatNumber(1314.56789, { thousandthsSeparator: ',' }) // => '1,314.567,89'