您的位置:首页 > 其它

如何取得一个字符串在另外一个字符串中出现的次数

2009-10-22 19:33 330 查看
如何取得一个字符串在另外一个字符串中出现的次数
问题:
怎样取得一个字符串在另外一个字符串中出现的次数?
方法:


程序代码
Function strCount(strA, strB)
lngA = Len(strA)
lngB = Len(strB)
lngC = Len(Replace(strA, strB, ""))
strCount = (lngA - lngC) / lngB
End Function
str="ddd,sdfdfgggdd"
d_count=ubound(split(str,"d",-1,1))
response.write "d的个数:" & cstr(d_count)

f_count=ubound(split(str,"f",-1,1))
response.write "f的个数:" & cstr(f_count)

g_count=ubound(split(str,"g",-1,1))
response.write "g的个数:" & cstr(g_count)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: