当前位置:主页 > 查看内容

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

发布时间:2021-04-21 00:00| 位朋友查看

简介:如何实现非大小写的替换? 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 Ust……

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

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


本文转载自网络,原文链接:https://m.jb51.net/article/4677.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:如何终止浏览器的Cahce页面? 下一篇:没有了

推荐图文


随机推荐