private sub Class_Initialize()
set regEx =new RegExp
regEx.IgnoreCase = True '设置是否区分大小写。
regEx.Global = True '设置全局可用性。
end sub
private regEx
Property get CN(x)
dim Arr()
dim maxBound : maxBound = CNBlockCount
redim Arr(maxBound)
dim i:i=1
For each Match in regEx.Execute(str)
Arr(i) = Match
i = i + 1
next
if x<=maxBound then CN = Arr(x)
End Property
Property get CNcount
'返回含有中文的字数
regEx.Pattern = "[\u4e00-\u9fa5]"
CNcount = findCHNnum()
End Property
Property get CNBlockCount
'返回含有中文的块数
regEx.Pattern = "[\u4e00-\u9fa5]+"
CNBlockCount = findCHNnum()
End Property
private function findCHNnum()
findCHNnum = regEx.Execute(str).count
end function
private sub Class_Terminate()
set regEx = nothing
end sub