If CHECK_ID > 922">

ASP强转数字的两个通用函数

80酷酷网    80kuku.com

  

'第一个函数,可以强转带小数点的数字格式。 

Public Function CheckNumeric(ByVal CHECK_ID)
  If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then
   If CHECK_ID > 922337203685477 Then CHECK_ID = 0
   If CHECK_ID < -922337203685477 Then CHECK_ID = 0
   CHECK_ID = CCur(CHECK_ID)
  Else
   CHECK_ID = 0
  End If
  CheckNumeric = CHECK_ID
 End Function

 

'第二个函数,可以强转为整数格式。 

 Public Function ChkNumeric(ByVal CHECK_ID)
  If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then
   If CHECK_ID < 0 Then CHECK_ID = 0
   If CHECK_ID > 2147483647 Then CHECK_ID = 0
   CHECK_ID = CLng(CHECK_ID)
  Else
   CHECK_ID = 0
  End If
  ChkNumeric = CHECK_ID
 End Function

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