Click to See Complete Forum and Search --> : format number with commas


esthera
02-06-2005, 02:42 PM
How do you format a number like 3456565656 with commas?

russell
02-06-2005, 04:18 PM
the FormatNumber() function accepts 5 arguments:

expression, required, the number to be formatted
NumDigitsAfterDecimal, optional, self explanatory
IncludeLeadingDigit, optional, show a '0' before decimals < 1 (true/false)
UseParensForNegativeNumbers, optional, (true/false)
GroupDigits, optional, use commas? (true/false)

So to answer your question, it would look like this:

num = formatNumber(someNumber, 2, true, true, true)

Bullschmidt
02-09-2005, 08:11 AM
And for more about this and other functions:

Visual Basic Scripting Edition VBScript Language Reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbscripttoc.asp