一个判断字符串的数值类型

80酷酷网    80kuku.com

  字符串支持判断返回任何数值型的类型数据:

Function GetNumType(sVal)
Dim sType
If Not IsNumeric(sVal) Then
GetNumType="Unknow"
Exit Function
End If
Execute "sType=TypeName("&sVal&")"
GetNumType=sType
End Function

测试:
Response.Write GetNumType("9999") '返回:Integer
Response.Write GetNumType("999999999") '返回:Long
Response.Write GetNumType("99999999999999") '返回:Double
Response.Write GetNumType("asdfasd") '返回:Unknow













分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: