獲取中英文字符串長度

 

Function  LenStr(sContent)
    Dim regEx,Match,Matches
    Set regEx = New RegExp
    regEx.Pattern  ="[^/x00-/xff]"
    regEx.IgnoreCase = False
    regEx.Global = True
    Set Matches = regEx.Execute(sContent)
    For Each Match in Matches
        RetStr = RetStr&Match.Value
    Next
    LenStr = RetStr
End Function
sContent = "我hen愛nia"
Str = LenStr(sContent)
Response.Write Len(Str)+Len(sContent)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章