cint与clng含义:
都可以强制将一个表达式转换成数据类型
cint与clng处理数据的范围:
CIntnbsp;nbsp;nbsp; Integernbsp;nbsp;nbsp;nbsp;nbsp;nbsp; -32,768 至 32,767,小数部分四舍五入。 CLngnbsp;nbsp;nbsp; Longnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; -2,147,483,648 至 2,147,483,647,小数部分四舍五入。
所谓溢出指的是超出处理数据的范围,下面代码是处理数据防止溢出的代码,大家可以自己看看:
'检测是否是短整数 复制代码 代码如下: sub Is_Int(string) if len(abs(string))gt;10 then response.write "数据溢出":response.end if instr(string,"-")lt;1 then nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; if cint(left(string,4))gt;3276 and cint(right(string,1))gt;7 then response.write "数据溢出":response.end nbsp;nbsp;nbsp; else nbsp;nbsp;nbsp;nbsp;nbsp; if cint(left(abs(string),4))gt;3276 and cint(right(string,1))gt;8 then response.write "数据溢出":response.end nbsp;nbsp; end if end sub
'检测是否是长整数 复制代码 代码如下: sub Is_Lng(string) if len(abs(string))gt;10 then response.write "数据溢出":response.end if instr(string,"-")lt;1 then nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; if clng(left(string,9))gt;214748364 and clng(right(string,1))gt;7 then response.write "数据溢出":response.end nbsp;nbsp;nbsp; else nbsp;nbsp;nbsp;nbsp;nbsp; if clng(left(abs(string),9))gt;21478364 and clng(right(string,1))gt;8 then response.write "数据溢出":response.end nbsp;nbsp; end if end sub
(编辑:淮北站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|