FormatNumber()

Syntax

Result$ = FormatNumber(Number.d [, NbDecimals [, DecimalPoint$ [, ThousandSeparator$]]])
Description
Format a number into money-like format.

Parameters

Number The number to format.
NbDecimals (optional) Number of decimals to display.
DecimalPoint$ (optional) The string to use to split the decimal and integer parts. It can be a multiple character string. Default value is ".".
ThousandSeparator$ (optional) The string to use to separate thousands. It can be a multiple character string. Default value is ",".

Return value

The formatted number.

Remarks

This command can also be used to output a rounded decimal number.

Example

  Debug FormatNumber(125400.25) ; Will display: 125,400.25
  
  Debug FormatNumber(1125.8375, 2, ".", "") ; will display 1125.84 (round the number to the specified fractional digits)
  Debug FormatNumber(125.23, 1) ; will display: 125.2 (round the number to one fractional digit)

See Also

Str(), StrU(), StrF(), StrD(), Round()

Supported OS

All

<- FindString() - String Index - Hex() ->