Name
FormatNumber -- convert number to string with digit separation (V10.0)
Synopsis
s$ = FormatNumber(n[, decimals, point$, thousands$])
Function
This function converts the number specified by n to a string, separating the digits by the thousands and clipping the decimal places to the number passed in the decimals argument. You can also pass the character that should be used as a decimal separator in point$ and the character that should be used as a thousands separator in thousands$. This makes FormatNumber() suitable for locale-sensitive number formatting. You can use the GetLocaleInfo() function to get the decimal point and thousand separator character for the current locale. See GetLocaleInfo for details.

Inputs
n
number to convert to string
decimals
optional: number of decimal places to use (defaults to 0)
point$
optional: character to use as decimal point (defaults to ".")
thousands$
optional: character to use as thousands separator (defaults to ",")
Results
s$
formatted string
Example
t = GetLocaleInfo()
s$ = FormatNumber(1234567.89, 2, t.DecimalPoint, t.ThousandSeparator)
DebugPrint(s$)
The code above will convert 1234567.89 to a string using the current locale's decimal point and thousand separator.

Show TOC