asp에서 Replace를 대소문자 구분없이 사용하기

-- ASP 2010. 11. 3. 14:56
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

' 안바뀌는 것 $ ^ |
' 혼자쓰면 안되는 것 * ( ) + \ [ ] . ?
Function Replace2(strSource, strFind, strReplace)
     Dim objRE
     
Set objRE = New RegExp
 
     objRE.Pattern = strFind
     objRE.IgnoreCase = True
     objRE.Global = True
    
     Replace2 = objRE.Replace(strSource, strReplace)
     Set objRE = Nothing
End Function

Function Replace3(strSource, strFind, strReplace)
    Dim intMapLen, intSchLen, intTmpLen
    Dim strRetTxt, strTmpTxt,
strFullTxt, strSchTxt
   
    intMapLen = 0
    intSchLen = Len(strFind)
   
    For intTmpLen = 1 To Len(strSource) + 1

        strSchTxt = Mid(strFind, intMapLen + 1, 1)
        strFullTxt = Mid(strSource, intTmpLen, 1)

        If UCase(strFullTxt) = UCase(strSchTxt) Then
            intMapLen = intMapLen + 1
            strTmpTxt = strTmpTxt & strFullTxt

            If intMapLen = intSchLen Then
                strRetTxt = strRetTxt & strReplace
                strTmpTxt = ""
                intMapLen = 0
                strSchTxt = Mid(strFind, 1, 1)
            End If
        Else
            If UCase(Mid(strFind, 1, 1)) = UCase(strFullTxt) Then
                strRetTxt = strRetTxt & strTmpTxt
                intMapLen = 1
                strTmpTxt = strFullTxt
            Else
                strRetTxt = strRetTxt & strTmpTxt & strFullTxt
                strTmpTxt = ""
                intMapLen = 0
            End If
        End If
    Next
   
    Replace3 = strRetTxt
End Function

'-- ASP' 카테고리의 다른 글

Classic ASP에서 DB사용 시 ExecuteNoRecord 사용  (0) 2010.11.25
Classic ASP Framework  (0) 2010.11.23
ASP Cint (value) 함수 사용시 주의점  (0) 2010.07.16
윈도우2008 IIS7.0에서 Classic ASP를 사용할 때  (0) 2010.03.23
asp용 md5  (0) 2009.07.30
posted by 어린왕자악꿍