当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何实现非大小写的替换?

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

2017年12月08日  | 移动技术网IT编程  | 我要评论

dailifuwuqi,中世纪西秦帝国,北京癫痫军海医院

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

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 ")

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网