在asp中,FormatNumber的用法是怎样的,IsNumber的作用是什么

如题所述

FormatNumber 函数
返回表达式,此表达式已被格式化为数值。

  下面例子利用 FormatNumber 函数把数值格式化为带四位小数点的数:
  Function FormatNumberDemo
  Dim MyAngle, MySecant, MyNumber
  MyAngle = 1.3 ' 用弧度定义角。
  MySecant = 1 / Cos(MyAngle) ' 计算正割值。
  FormatNumberDemo = FormatNumber(MySecant,4) ' 把 MySecant 格式化为带四位小数点的数。
  End Function

ASP中没IsNumber这个说法,应该是IsNumeric,判断变量是否为数字类型的。

用法如下:

dim age
age=Request.Form("age")
If Not IsNumeric(age) Then
Response.Write "年龄必须为数字类型!"
End If
温馨提示:答案为网友推荐,仅供参考