asp学习网: 首页 >> asp自定义函数 >> 得到一个字符串在另一个字符串当中出现几次的函数

得到一个字符串在另一个字符串当中出现几次的函数

GetRepeatTimes(TheChar,TheString)

本函数 用以得到一个字符串在另一个字符串当中出现的次数

例子:
response.write GetRepeatTimes("a","www.aspxuexi.com")
response.write GetRepeatTimes("122","122122133112212222")

函数代码:

Function GetRepeatTimes(TheChar,TheString)
 GetRepeatTimes = (len(TheString)-len(replace(TheString,TheChar,"")))/len(TheChar)
End Function

from:asp学习网/title:得到一个字符串在另一个字符串当中出现几次的函数/ time:2006-5-13 23:12:11

本文主题得到一个字符串在另一个字符串当中出现几次的函数

asp教程 ©2006-2007 aspxuexi.com | 关于站点 | 版权隐私 | 站内搜索
复制或者翻版 请于夜间进行