我写ASP时常用到的一些函数(2)

发表于:2007-06-30来源:作者:点击数: 标签:
‘’//过滤脏话函数Function ChkBadWords(fString,BadWords)dim bwords bwords = split(BadWords, |) for i = 0 to ubound(bwords) fString = Replace(fString, bwords(i), string(len(bwords(i)),*), 1,-1,1) nextChkBadWords = fStringEnd Function‘’用正
‘’//过滤脏话函数Function ChkBadWords(fString,BadWords)dim bwords bwords = split(BadWords, "|") for i = 0 to ubound(bwords) fString = Replace(fString, bwords(i), string(len(bwords(i)),"*"), 1,-1,1) nextChkBadWords = fStringEnd Function‘’用正则表达式突出显示字符串中查询到的单词的函数Function BoldWord(strContent,word) dim objRegExp Set objRegExp=new RegExp objRegExp.IgnoreCase =true objRegExp.Global=True
objRegExp.Pattern="(" & word & ")" strContent=objRegExp.Replace(strContent,"<font color=""#ff0000"">$1</font>" )
Set objRegExp=Nothing BoldWord=strContent End Function

原文转自:http://www.ltesting.net