当前位置: 首页 > 网络学院 > 客户端脚本教程 > VBScript > VBScript FormatNumber 函数
The FormatNumber function returns an expression formatted as a number.
FormatNumber 函数可返回表达式,此表达式已被格式化为数值
FormatNumber(Expression[,NumDigAfterDec[, |
参数 | 描述 |
---|---|
expression | Required. The expression to be formatted 必选项。要被格式化的表达式 |
NumDigAfterDec | Optional. Indicates how many places to the right of the decimal are displayed. Default is -1 (the computer's regional settings are used) 可选项。指示小数点右侧显示位数的数值。默认值为 -1(指示使用的是计算机的区域设置)。 |
IncLeadingDig | Optional. Indicates whether or not a leading zero is displayed for fractional values: 可选项。三态常数,指示是否显示小数值小数点前面的零
|
UseParForNegNum | Optional. Indicates whether or not to place negative values within parentheses: 可选项。三态常数,指示是否将负值置于括号中
|
GroupDig | Optional. Indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings: 可选项。三态常数,指示是否使用计算机区域设置中指定的数字分组符号将数字分组。
|
document.write(FormatNumber(20000)) 输出: 20,000.00 |
document.write(FormatNumber(20000.578,2)) 输出: 20,000.58 |
document.write(FormatNumber(20000.578,2,,,0)) 输出: 20000.58 |