如何实现非大小写的替换?
如何实现非大小写的替换?
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 ")
上一篇: JSP实现的简单分页显示效果代码