Chinese | string <script language= "VBScript" >
Class Cnword
Public Str
Private Sub Class_Initialize ()
Set RegEx =new REGEXP
Regex.ignorecase = True ' Sets whether case sensitive.
Regex.global = True ' Sets global availability.
End Sub
Private RegEx
Property Get CN (x)
Dim Arr ()
Dim Maxbound:maxbound = Cnblockcount
ReDim ARR (Maxbound)
Dim I:i=1
For the Match in Regex.execute (str)
ARR (i) = Match
i = i + 1
Next
If X<=maxbound then CN = ARR (x)
End Property
Property Get Cncount
' Returns the number of words containing Chinese
Regex.pattern = "[\u4e00-\u9fa5]"
Cncount = Findchnnum ()
End Property
Property Get Cnblockcount
' Returns the number of blocks containing Chinese
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
End Class
Set ccc= new Cnword
CCC.STR = "Cnword class reference instance, VBS"
MsgBox "Contains Chinese number" & CCC. Cncount
MsgBox "Contains Chinese block number" & CCC. Cnblockcount
MsgBox "2nd Chinese block is--->" & CCC. CN (2)
Set CCC = Nothing
</script>