Format a number.

      FormatNumber(number [,DecimalPlaces [,IncludeLeadingZero
          [,UseParenthesis [, GroupDigits]]]] )

   number              The number to format.
   DecimalPlaces       Number of digits to display after the decimal point.

   IncludeLeadingZero  Include a leading zero for numbers <1 and > -1

   UseParenthesis      Show negative numbers in Parentheis (500) = -500

   GroupDigits         Group large numbers with commas (or the regional delimiter)


Set intDemo = 150000.56
WScript.Echo FormatNumber(intDemo,1)

“A good decision is based on knowledge and not on numbers” ~ Plato

Related VBScript commands

FormatCurrency - Format a number with a currency symbol.
FormatPercent - Format a number with a % symbol.
FormatDateTime - Format a Date/Time value.
Equivalent PowerShell:
$myVar = "{0:N4}" -f 450 Will display 450.0000 (4 decimal places).

Copyright © 1999-2023
Some rights reserved