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

[推薦]ASP編程通用函數(shù)收藏大全第2/2頁

 更新時間:2007年08月08日 10:29:45   作者:  

區(qū)分中英文長度,限長截斷標(biāo)題字符
復(fù)制代碼 代碼如下:

<% 
'****************************** 
'函數(shù):InterceptString(txt,length) 
'參數(shù):txt,待判斷截取的標(biāo)題字符串;length,標(biāo)題長度 
'作者:阿里西西 
'日期:2007/7/12 
'描述:區(qū)分中英文,限長截斷標(biāo)題字符 
'示例:<%=InterceptString("歡迎光臨阿里西西WEB開發(fā)網(wǎng)站",8)%> 
'****************************** 
Function InterceptString(txt,length) 
 dim x,y,ii 
 txt=trim(txt) 
 x = len(txt) 
 y = 0 
 if x >= 1 then 
  for ii = 1 to x 
   if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是漢字 
    y = y + 2 
   else 
    y = y + 1 
   end if 
   if y >= length then 
    txt = left(trim(txt),ii) '字符串限長 
    exit for 
   end if 
  next 
  InterceptString = txt 
 else 
  InterceptString = "" 
 end if 
End Function 
%>

復(fù)制代碼 代碼如下:

<%
'******************************
'函數(shù):strLength(str)
'參數(shù):str,待判斷長度的字符串
'作者:阿里西西
'日期:2007/7/12
'描述:求字符串長度。漢字算兩個字符,英文算一個字符
'示例:<%=strLength("歡迎光臨阿里西西")%>
'******************************
function strLength(str)
 ON ERROR RESUME NEXT
 dim WINNT_CHINESE
 WINNT_CHINESE    = (len("中國")=2)
 if WINNT_CHINESE then
        dim l,t,c
        dim i
        l=len(str)
        t=l
        for i=1 to l
         c=asc(mid(str,i,1))
            if c<0 then c=c+65536
            if c>255 then
                t=t+1
            end if
        next
        strLength=t
    else 
        strLength=len(str)
    end if
    if err.number<>0 then err.clear
end function
%>

復(fù)制代碼 代碼如下:

采集獲取遠(yuǎn)程頁面的內(nèi)容<%
'******************************
'函數(shù):GetURL(url) 
'參數(shù):url,遠(yuǎn)程頁面的網(wǎng)址,必須輸入完整格式的網(wǎng)址
'作者:阿里西西
'日期:2007/7/12
'描述:采集獲取遠(yuǎn)程頁面的內(nèi)容,很多小偷和采集程序都用到
'示例:<%=GetURL(http://www.alixixi.com/index.html)%>
'******************************
Function GetURL(url) 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "GET", url, False
.Send 
GetURL = bytes2bstr(.responsebody)
'對取得信息進(jìn)行驗證,如果信息長度小于100則說明截取失敗
if len(.responsebody)<100 then
response.write "獲取遠(yuǎn)程文件 <a href="&url&" target=_blank>"&url&"</a> 失敗。"
response.end
end if
End With 
Set Retrieval = Nothing 
End Function
' 二進(jìn)制轉(zhuǎn)字符串,否則會出現(xiàn)亂碼的!
function bytes2bstr(vin) 
strreturn = "" 
for i = 1 to lenb(vin) 
thischarcode = ascb(midb(vin,i,1)) 
if thischarcode < &h80 then 
strreturn = strreturn & chr(thischarcode) 
else 
nextcharcode = ascb(midb(vin,i+1,1)) 
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) 
i = i + 1 
end if 
next 
bytes2bstr = strreturn 
end function 
%>


 

相關(guān)文章

最新評論

亚东县| 松阳县| 宁国市| 昭通市| 宁安市| 定州市| 保亭| 和田县| 阳城县| 琼结县| 新竹市| 丁青县| 兴国县| 乐安县| 仙桃市| 定兴县| 宁南县| 济宁市| 晋州市| 章丘市| 尚志市| 揭东县| 吉林省| 大理市| 宜丰县| 班玛县| 鹰潭市| 喀什市| 来安县| 合川市| 顺义区| 乐至县| 三门峡市| 诏安县| 文昌市| 伊金霍洛旗| 信宜市| 香港| 色达县| 太仆寺旗| 布拖县|