- 帖子
- 605
- 主題
- 92
- 精華
- 0
- 積分
- 648
- 點名
- 0
- 作業系統
- windows
- 軟體版本
- 7
- 閱讀權限
- 50
- 性別
- 男
- 來自
- macau
- 註冊時間
- 2013-4-5
- 最後登錄
- 2019-2-10
 
|
用 “正規表示式”
Function CountDblChr(ByVal sCh As String) As Integer
Set re = CreateObject("vbscript.regexp")
're.Pattern = "[\u4e00-\u9fa5]" '判斷中文字(包括特殊字,但不包括符號。和數字如1)
re.Pattern = "[^\x00-\xff]" '判斷所有的全形字
re.Global = True
re.IgnoreCase = True
Set matches = re.Execute(sCh)
CountDblChr = matches.Count
Set re = Nothing
End Function |
|