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

使用vbscript生成36進制自動增長序號的實現(xiàn)代碼

 更新時間:2014年08月14日 10:15:03   投稿:junjie  
這篇文章主要介紹了使用vbscript生成36進制自動增長序號的實現(xiàn)代碼,本文代碼也可以在ASP中使用,需要的朋友可以參考下

asp生成0~9,a~z的36進制字符串,運行下面示例需要使用IE核心的瀏覽器,其他非IE核心瀏覽器不支持vbscript。

實現(xiàn)代碼:

<script language="vbscript">
function getinitstring(l)'初始化指定長度的0字符串
 l=l-1
 for i=0 to l
  getinitstring="0"&getinitstring
 next
end function
function getnextchar(chrcode)'獲取下一個字符
 if chrcode=57 then'數(shù)字和字母標(biāo)ascii不連貫,需要特殊處理一下
  getnextchar="a"
 else
  getnextchar=chr(chrcode+1)
 end if
end function
function getnextno(s,l)'獲取下自增1的字符串
 if trim(s)="" then'初始化字符串
  getnextno=getinitstring(l):exit function
 end if
 l=len(s)-1
 dim a():redim a(l)
 for i=0 to l'拆分成數(shù)組
  a(i)=mid(s,i+1,1)
 next
 carry=false'進位標(biāo)志
 for i=l to 0 step -1'從最低位開始遍歷
  chrcode=asc(a(i))
  if carry then
   if chrcode<>122 then'不是z,自增后退出for循環(huán),否則繼續(xù)進位
    a(i)=getnextchar(chrcode):exit for'退出循環(huán)
   elseif i=0 then
    getnextno="已經(jīng)達(dá)到最大長度,無法繼續(xù)進位,需要修改長度":exit function
   end if
  end if
  if a(i)="z" then
   carry=true:a(i)="0"
  else
   a(i)=getnextchar(chrcode):exit for'退出循環(huán)
  end if
 next
 for i=0 to l'組合返回字符串
  getnextno=getnextno&a(i)
 next
end function
s=""
initlen=6
s=getnextno(s,initlen)
msgbox s'000000
s=getnextno(s,initlen)
msgbox s'000001
s="aaazzz"
s=getnextno(s,initlen)
msgbox s'aab000
s="zzzzzz"
s=getnextno(s,initlen)
msgbox s'已經(jīng)達(dá)到最大長度,無法繼續(xù)進位,需要修改長度
</script>

相關(guān)文章

最新評論

文化| 百色市| 饶平县| 乌恰县| 正蓝旗| 苏州市| 双鸭山市| 行唐县| 马公市| 安康市| 宜州市| 鄂州市| 香河县| 刚察县| 普宁市| 连山| 古蔺县| 会泽县| 虹口区| 康马县| 吉安市| 延安市| 新民市| 平果县| 小金县| 阳曲县| 平和县| 华蓥市| 海淀区| 东丰县| 滕州市| 浦城县| 邵阳市| 凯里市| 三亚市| 华池县| 宣武区| 和政县| 墨脱县| 东兴市| 康马县|