Visual Basic Scripting Edition | 语言参考 |
FormatPercent 函数返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 FormatPercent(expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])
FormatPercent 函数的语法有以下参数: 参数Expression 必选项。要被格式化的表达式。 NumDigitsAfterDecimal 可选项。指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。 IncludeLeadingDigit 可选项。三态常数,指示是否显示小数值小数点前面的零。有关数值,请参阅“设置”部分。 UseParensForNegativeNumbers 可选项。三态常数,指示是否将负值置于括号中。有关数值,请参阅“设置”部分。 GroupDigits 可选项。三态常数,指示是否使用计算机区域设置中指定的数字分组符号将数字分组。有关数值,请参阅“设置”部分。 设置IncludeLeadingDigit、UseParensForNegativeNumbers 和 GroupDigits 参数可以有以下值: 常数 | 值 | 描述 |
---|
TristateTrue | -1 | True | TristateFalse | 0 | False | TristateUseDefault | -2 | 使用计算机区域设置中的设置。 |
说明当省略一个或多个可选项参数时,由计算机区域设置提供被省略参数的值。 注意 所有设置信息均取自区域设置的“数字”附签。 下面例子利用 FormatPercent 函数把表达式格式化为百分数: Dim MyPercent
MyPercent =FormatPercent(2/32) 'MyPercent 包含 6.25% 。
要求版本2 请参阅FormatCurrency 函数 | FormatDateTime 函数 | FormatNumber 函数
返回首页
|