亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp 標(biāo)記字符串中指定字符變色不區(qū)分大小寫(xiě)

 更新時(shí)間:2013年04月07日 12:12:17   作者:  
今天遇到這種問(wèn)題,單純的使用replace函數(shù)不行,他會(huì)改變?cè)械淖址拇笮?xiě),在網(wǎng)上找到相關(guān)的代碼,自己備份下

普通的替換函數(shù)

復(fù)制代碼 代碼如下:

public function HighLight(S,F)
dim tL,tM,tR,k
tL=""
tM=""
tR=S
k=instr(1,tR,F,1)
do while k>0
tL=tL & left(tR,k-1)
tM=mid(tR,k,len(F))
tL=tL & "<span style='color:red'>" & tM & "</span>"
tR=right(tR,Len(tR)-len(F)-k+1)
k=instr(1,tR,F,1)
loop
HighLight=tL & tR
end function
 tS="abcaBcabCaBCabcaBCa"
tF="bc"
response.Write(tS)
response.Write("<br/>")
response.Write(HighLight(tS,tF))

正則表達(dá)式

復(fù)制代碼 代碼如下:

Function HighLight(S,F)
Dim regEx
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(" & F & ")"
HighLight = regEx.Replace(S,"<span style='color:red'>$1</span>")
End Function
Response.write HighLight("abcaBcabCaBCabcaBCa","bc")

相關(guān)文章

最新評(píng)論