最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp中cint與clng的區(qū)別分析

 更新時(shí)間:2021年08月18日 12:48:45   投稿:mdxy-dxy  
cint與clng含義都可以強(qiáng)制將一個(gè)表達(dá)式轉(zhuǎn)換成數(shù)據(jù)類(lèi)型,介紹歸介紹,如果文章id一定要使用clng,不可能文章就32767篇的

cint與clng含義:

都可以強(qiáng)制將一個(gè)表達(dá)式轉(zhuǎn)換成數(shù)據(jù)類(lèi)型

cint與clng處理數(shù)據(jù)的范圍:

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

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

'檢測(cè)是否是短整數(shù) 
sub Is_Int(string) 
if len(abs(string))>10 then response.write "數(shù)據(jù)溢出":response.end
if instr(string,"-")<1 then
       if cint(left(string,4))>3276 and cint(right(string,1))>7 then response.write "數(shù)據(jù)溢出":response.end
    else
      if cint(left(abs(string),4))>3276 and cint(right(string,1))>8 then response.write "數(shù)據(jù)溢出":response.end 
   end if 
end sub 

檢測(cè)是否是長(zhǎng)整數(shù)

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

具體使用看這個(gè)數(shù)字可能最大區(qū)間,一般分頁(yè)可以用cint,文章id用clng比較好。

在我以前做asp開(kāi)發(fā)時(shí),特別是涉及到商務(wù)類(lèi)的計(jì)算時(shí),clng用的比較多,cint主要用于處理短整數(shù)。
有了上面的二個(gè)函數(shù),有效防止了溢出,很有用。

相關(guān)文章

最新評(píng)論

南城县| 柳河县| 漳浦县| 仙居县| 黑龙江省| 靖西县| 临武县| 平谷区| 新乡县| 兴安盟| 伊川县| 花莲县| 松滋市| 平阳县| 扶沟县| 申扎县| 玉龙| 环江| 翁源县| 县级市| 区。| 都江堰市| 海林市| 高雄市| 阿拉善盟| 金坛市| 工布江达县| 礼泉县| 大余县| 安庆市| 济阳县| 孟津县| 若尔盖县| 沙坪坝区| 渝中区| 泉州市| 海口市| 巩留县| 班玛县| 绿春县| 河北区|