国产精品网站在线观看免费传媒,国产强被迫伦姧无码,欧 国产成人欧美一区二区三区vr_制服丝袜在线日韩_丝瓜

asp統(tǒng)計字符串中中文字符的個數(shù)

2013/2/6 17:33:061851 閱讀

    由于asp中把英文單詞與漢字全是看成一個字符,結果,有些全英文的標題,顯示出來非常短,使用下面方法可分別統(tǒng)計字符串中中、英文字符的個數(shù):
    function length(input) 
    dim c,e 
    c=ubound(split(escape(input),"%u")) 
    e=len(input)-c 
    length ="漢字:" & c & "個,英文" & e & "個" 
    end function 
    
    '測試結果 
    
    dim str : str = "判斷一串字符串中,有多少個english,多少個中文?" 
    '測試執(zhí)行1萬次時間 
    
    dim t1,t2 
    t1=timer() 
    for i=1 to 10000 
    response.write length(str) & "" 
    next 
    
    t2=timer() 
    response.write "執(zhí)行1萬次需要:" & (t2-t1 )*1000 & "毫秒" 
    
    '執(zhí)行1萬次需要:171.875毫秒 






    下一條:恢復只有MDF文件的SQL SERVER數(shù)據(jù)庫

    上一條:SQL Server 2000常用命令,語法使用方法

棗莊西橋網(wǎng)絡微信小程序微信小程序

棗莊西橋網(wǎng)絡手機站二維碼掃描手機瀏覽