惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
P
Proofpoint News Feed
The Cloudflare Blog
D
Docker
大猫的无限游戏
大猫的无限游戏

博客园 - 明仔¥

TP6 实现上传文件 页面自适应纯CSS,使用rem单位 jQuery解决高度统一问题 dedecms Ajax异步获取文章列表 手机端页面自适应解决方案—rem布局 mysql中bigint、int、mediumint、smallint 和 tinyint的取值范围 修改PHP 上传文件大小限制 WampServer下修改和重置MySQL密码 CSS文件添加 @charset "utf-8"; 可能会引起样式在IE6下失效 Windows Server 2003下MySQL 5.1.32安装图文 如何彻底卸载MySQL 最好用的mysql密码忘记的解决方法 ASP将ACCESS表中的数据记录导入到EXCEL文件中 - 明仔¥ - 博客园 几个比较好看的Button的CSS - 明仔¥ - 博客园 网站样式切换效果 - 明仔¥ - 博客园 asp生成excel报表 VB中如何将字符串转换成数值来运算? utf-8编码用于asp 出现乱码的问题--从数据库调用的是乱码--gb2312转换utf-8 - 明仔¥ - 博客园 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法 - 明仔¥ - 博客园
clng与cint的区别及防溢出函数 - 明仔¥ - 博客园
明仔¥ · 2010-12-29 · via 博客园 - 明仔¥

cint与clng含义:

都可以强制将一个表达式转换成数据类型

cint与clng处理数据的范围:

CInt    Integer       -32,768 至 32,767,小数部分四舍五入。
CLng    Long         -2,147,483,648 至 2,147,483,647,小数部分四舍五入。

所谓溢出指的是超出处理数据的范围,下面代码是处理数据防止溢出的代码,大家可以自己看看:

'检测是否是短整数
sub Is_Lng(string)
if len(abs(string))>10 then response.write "数据溢出":response.end
if instr(string,"-")<1 then
       if cint(left(string,4))>3276 and cint(right(string,1))>7 then response.write "数据溢出":response.end
    else
      if cint(left(abs(string),4))>3276 and cint(right(string,1))>8 then response.write "数据溢出":response.end
   end if
end sub

'检测是否是长整数

sub Is_Lng(string)
if len(abs(string))>10 then response.write "数据溢出":response.end
if instr(string,"-")<1 then
       if clng(left(string,9))>214748364 and clng(right(string,1))>7 then response.write "数据溢出":response.end
    else
      if clng(left(abs(string),9))>21478364 and clng(right(string,1))>8 then response.write "数据溢出":response.end
   end if
end sub