用VBA統計字符串中的中文字個(gè)數
' 統計中文字的個(gè)數 ' 作者:朱亦文 ' 日期:2006.01.05 Function CountZh(ByVal sZh As String) As Integer Dim re As New RegExp Dim matches As MatchCollection re.Pattern = "[\u4e00-\u9fa5]" re.Global = True re.IgnoreCase = True Set matches = re.Execute(sZh) CountZh = matches.Count Set re = Nothing End Function |
請引用Microsoft VBScript Regular Express 5.
聯(lián)系客服