获取中英文字符串长度

来源:互联网 发布:网络打假流程 编辑:程序博客网 时间:2024/05/22 10:24

 

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)

原创粉丝点击