如何实现非大小写的替换?

时间:2021-05-18

如何实现非大小写的替换?

Function ReplaceNoIgnoreCase(str,replStr)

If len(replStr)<1 or str="" Then
ReplaceTest=str
Exit function
End If

Dim LoopN
LoopN=1

Dim TmpStr,inStrN,LenreplStr,Ustr,UreplStr
LenreplStr = Len(replStr)
TmpStr = str
Ustr = Ucase(str)
UreplStr = Ucase(replStr)
str=""

inStrN = inStr(Ustr,UreplStr)

Do While inStrN>0 and TmpStr<>""
LoopN = LoopN+1
If LoopN>10 Then Exit Function
str=str & Left(TmpStr,inStrN-1)
TmpStr = Mid(TmpStr,inStrN)
UStr = Mid(UStr,inStrN)
str=str & "<font color=ff0000>" & Left(TmpStr,LenreplStr) & "</font>"
TmpStr = Mid(TmpStr,LenreplStr+1)
UStr = Mid(UStr,LenreplStr+1)
inStrN = inStr(Ustr,UreplStr)
If inStrN<1 Then str=str&TmpStr
Loop
ReplaceTest = str

End Function

Response.Write "<p>result:"&ReplaceNoIgnoreCase("Flying Happy in the Sun ")

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章