魔方网表 让信息化更简单

 找回密码
 注册
查看: 1994|回复: 0

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

[复制链接]
lnxxnchzyl 发表于 2009-10-19 09:58:28 | 显示全部楼层 |阅读模式
使用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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|魔方软件 ( 京ICP备08008787号 )

京公网安备 11010702001722号

GMT+8, 2024-5-2 06:26 , Processed in 0.212973 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表