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

作者:网络 来源:佚名 更新时间:2009-02-14 00:55:50 点击:

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

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