网络编程
位置:首页>> 网络编程>> Asp编程>> 如何解决“cint和clng的溢出出错”问题?

如何解决“cint和clng的溢出出错”问题?

 来源:asp之家 发布时间:2009-12-03 20:21:00 

标签:cint,clng,溢出,错误

 一、检测它是不是整数

function Is_Int(a_str) 
   if not isnumeric(a_str) or len(str) > 5 then 
      Is_Int = false  
      exit function  
   elseif len(str) < 5 then 
      Is_Int = true  
      exit function  
   end if    
   if cint(left(a_str , 4)) > 3276 then 
      Is_Int = false 
      exit function 
   elseif cint(left(a_str , 4)) = 3276 and cint(right(a_str , 1)) > 7 then 
      Is_Int = false 
      exit function 
   else 
      Is_Int = true 
      exit function 
   end if    
end function 

 二、检测它是不是长整数

function Is_Lng(a_str) 
   if not isnumeric(a_str) or len(str) > 10 then 
      Is_Lng = false 
      exit function  
   elseif len(str) < 10 then 
      Is_Lng = true  
      exit function  
   end if    
   if clng(left(a_str , 9)) > 214748367 then 
      Is_Lng = false 
      exit function 
   elseif clng(left(a_str , 9)) = 214748367 and clng(right(a_str , 1)) > 7 then 
      Is_Lng = false 
      exit function 
   else 
      Is_Lng = true 
      exit function 
   end if    
end function 


 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com