Do not use regular expressions to implement case-insensitive substitution

Source: Internet
Author: User
Case | regular Function replacenoignorecase (STR,REPLSTR) </p><p>if len (replstr) <1 or str= "" Then
Replacetest=str
Exit function
End If</p><p>dim LOOPN
Loopn=1</p><p>dim Tmpstr,instrn,lenreplstr,ustr,ureplstr
Lenreplstr = Len (REPLSTR)
TMPSTR = str
USTR = Ucase (str)
Ureplstr = Ucase (REPLSTR)
Str= "" </p><p>instrn = InStr (ustr,ureplstr) </p><p>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</p><p>end function</p><p>response.write "<p>result:" & Replacenoignorecase ("Wenmingdazhou Mingda electrical Mingda Equipment
Co.mingda,ltd "," Mingda ")


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.