设为首页
加入收藏
站点地图
首页 | 网站建设 | 杭州FPGA培训班,浙江FPGA培训班,苏州FPGA培训班,昆山FPGA培训班,常州FPGA培训班优化 | 网站推广 | 网络营销 | 网站运营 | 网站策划 | 在线讨论 | 下载中心
您当前的位置:WebSite -> 网站策划 -> 文章内容正文->检测整数和长整数的函数
 子栏目导航
 热门文章
 相关文章
 

检测整数和长整数的函数

作者:佚名  来源:转载  发布时间:2008-7-9 16:01:12  
经常见到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


 [返回上一页] [打 印] [收 藏]
百度中查看“检测整数和长整数的函数”相关文章

版权申明:本站网站策划资源来源网络,如有侵犯您的版权,请来Q告知 我们会在24小时内删除!

Copyright © 2008-2010 www.mepeixun.com All Rights Reserved
服务QQ:52466268 邮箱:meipeixun@163.com
备案号:苏ICP备07200130号