91网首页-91网页版-91网在线观看-91网站免费观看-91网站永久视频-91网站在线播放

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

asp cint clng的范圍與防止cint和clng的溢出解決方法大全

admin
2013年4月24日 22:22 本文熱度 4622

首先我們需要了解的是


cint范圍 -32,768 到 32,767。
clng范圍 -2,147,483,648 到 2,147,483,647。


cint與clng含義:


都可以強制將一個表達式轉換成數據類型


cint與clng處理數據的范圍:


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


所謂溢出指的是超出處理數據的范圍,下面代碼是處理數據防止溢出的代碼,大家可以自己看看:


'檢測是否是短整數



復制代碼 代碼如下:
sub Is_Int(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



以下是一些檢驗函數,需要的朋友可以參考下:


第一種:
一、檢測它是不是整數
復制代碼 代碼如下:
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


如果我們只需要是數子,其它的東西,都可以替換為空,下面這個是一個正則,替換非數字的正則
復制代碼 代碼如下:
function replacestr(str)
dim re
set re=new regexp
re.ignorecase=true
re.global=true
re.pattern="\D"
str=re.replace(str,"")
replacestr=str
set re=nothing
end function


下面是上面的調用方法
復制代碼 代碼如下:
id=replacestr(id)
if len(id)>5 then id=left(id,5)
if id<>"" then id=clng(id)
if err.number<>0 Or id="0" then response.redirect ""
dim rs
set rs=conn.execute("select id from news where id="&id&"")


該文章在 2013/4/24 22:22:58 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved

主站蜘蛛池模板: 国产精品亚 | 国产精品精品国内 | 欧洲日韩国产一区 | 91看片婬黄大片欧 | 欧亚欧洲码国产 | 午夜影院 | 国产三区四区五 | 欧美在线三| 国产精品视频第一 | 国产馆精品丝 | 日韩高清在线播放不 | 日韩成人精品二区 | 国产激情在线五月天 | 午夜不卡影院 | 国产呦网站免費資訊 | 国产亚洲玖玖精品 | 国产不卡视频一 | 99精品婷婷| 中文字幕日本 | 日韩欧美精品123 | 国产在线导航一区 | 岛国一区二区 | 成人午夜影院在線 | 精品成人一区二区 | 国产最新电影在线观 | 国产乱伦网站国 | 国产特级婬片免弗看 | 国产又黄 | 日本一丰满一bbw | www国产亚洲精品 | 午夜成人 | 丝袜视频 | 国产综合日韩伦理 | 欧美一级日韩一级 | 国产真实灌醉 | 日韩国产制服在线 | sss欧美一区二区 | 蜜臀tv| www在线看黄| 蜜桃臀一| 91最新在线观看 |