'不区分大小写，替换
Function YF_ReplaceC(Expression As String, Find As String, Replacewith As String) As String
   '不区分大小写，替换
   Dim As  Long  FF(),f1,i,u,Lf,Le,Lr,Lu,t
   Dim outstr As String, uExpression As String, uFind As String
   Dim As UByte Ptr pE,pF,uE,uF
   Dim As Any Ptr pU,pR
   Le = Len(Expression)
   Lf = Len(Find)
   Lr = Len(Replacewith)
   If Le = 0 Or Lf = 0 Then
      Return Expression
   Else
      '先找出替换数与位置----------------------------------
      u = -1
      ReDim ff(100)
      uExpression = Ucase(Expression)
      uFind = Ucase(Find)
      pE = Strptr(Expression)
      pR = Strptr(Replacewith)
      pF = Strptr(Find)
      uE = Strptr(uExpression)
      uF = Strptr(uFind)
      For i = 0 To Le - Lf
         If ue[i] = uf[0] Then
            If MemCmp(@ue[i], uf, lf) = 0 Then
               u += 1
               If u > Ubound(ff) Then ReDim Preserve ff(u + 100)
               ff(u) = i
               i += lf -1
            End If
         End If
      Next
      
      If u = -1 Then
         Return Expression
      Else
         Lu = Le + (Lr - Lf) * (u + 1)  'Lu=Le - Lf * (u+1) + Lr * (u+1)
         outstr = String(Lu, 0)
         pU = Strptr(outstr)
         t = 0
         For i = 0 To u
            Lu = FF(i) - t
            If Lu > 0 Then '复制原字符
               MemCpy(pU, pE, Lu)
               pU += Lu
            End If
            If Lr > 0 Then '复制替换字符
               MemCpy(pU, pR, Lr)
               pU += Lr
            End If
            pE += Lu + Lf
            t += Lu + Lf
         Next
         If t < le Then
            lu = le - t
            MemCpy(pU, pE, Lu)
         End If
         
         Return outstr
      End If
   End If
   
   
End Function
