lnxxnchzyl 发表于 2009-10-19 09:58:28

使用Replace()函数统计一个字符串在另一个字符串中出现的次数自定义函数:

使用Replace()函数统计一个字符串在另一个字符串中出现的次数自定义函数:

Public Function strCount(strA As String, strB As String) As Long
    Dim lngA As Long
    Dim lngB As Long
    Dim lngC As Long
    lngA = Len(strA)
    lngB = Len(strB)
    lngC = Len(Replace(strA, strB, ""))
    strCount = (lngA - lngC) / lngB
End Function
页: [1]
查看完整版本: 使用Replace()函数统计一个字符串在另一个字符串中出现的次数自定义函数: