asp中 小数问题解答

[ 2005-06-03 12:32:01 | 作者: admin ]
字号: | |
FormatNumber 函数
请参阅
FormatCurrency 函数 | FormatDateTime 函数 | FormatPercent 函数
要求
版本2
返回表达式,此表达式已被格式化为数值。

FormatNumber(
      expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]
)
Arguments
Expression
必选项。要被格式化的表达式。
NumDigitsAfterDecimal
可选项。指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。
IncludeLeadingDigit
可选项。三态常数,指示是否显示小数值小数点前面的零。有关数值,请参阅“设置”部分。
UseParensForNegativeNumbers
可选项。三态常数,指示是否将负值置于括号中。有关数值,请参阅“设置”部分。
GroupDigits
可选项。三态常数,指示是否使用计算机区域设置中指定的数字分组符号将数字分组。有关数值,请参阅“设置”部分。
设置
IncludeLeadingDigit、UseParensForNegativeNumbers 和 GroupDigits 参数可以有以下值:

常数 值 描述
TristateTrue -1 True
TristateFalse 0 False
TristateUseDefault -2 使用计算机区域设置中的设置。

说明
当省略一个或多个可选项参数时,由计算机区域设置提供被省略参数的值。

注意 所有设置信息均取自区域设置的“数字”附签。
下面例子利用 FormatNumber 函数把数值格式化为带四位小数点的数:

Function FormatNumberDemo
      Dim MyAngle, MySecant, MyNumber
      MyAngle = 1.3 ' 用弧度定义角。
      MySecant = 1 / Cos(MyAngle) ' 计算正割值。
      FormatNumberDemo = FormatNumber(MySecant,4) ' 把 MySecant 格式化为带四位小数点的数。
End Function
要求
评论Feed 评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=98

这篇日志没有评论。

此日志不可发表评论。