返回列表 上一主題 發帖

[分享] 正則表達式(bosco_yip 原創)

回復 1# Hsieh
原寫法是取代掉字串中非字母的字元
這裡稍微修改 , 提供另一種寫法
Function CountAlpha(Mystr)
    Dim RegExp As Object
    Set RegExp = CreateObject("vbscript.regexp")
    RegExp.Global = True
    RegExp.Pattern = "[a-zA-Z]"
    CountAlpha = RegExp.Execute(Mystr.Value).Count
End Function

TOP

        靜思自在 : 人生沒有所有權,只有生命的使用權。
返回列表 上一主題