Function ReplaceCaseIns( Str As String ,mStr As String ,NewStr As String) As String '不区分大小写替换
Local uStr,tStr,umStr As String
Local f1,f2,ti,si,L1,L2 As Long
uStr=UCase$(Str)
umStr=UCase$(mStr)
tStr= String$(Max&(1000, 2 * Len(Str)), 0) '创建足够大的输出缓冲区
f2=1
ti=StrPtr(tStr)
si=StrPtr(Str)
L1=Len(mStr)
L2=Len(NewStr)
Do
f1=Instr(f2,uStr,umStr)
If f1=0 Then
Memory Copy si+f2-1, ti , Len(str)-f2+1
ti=ti+ (Len(str)-f2+1)
Exit Do
End If
Memory Copy si+f2-1, ti , f1-f2
ti=ti+(f1-f2)
Poke$ ti,NewStr :ti = ti + L2
f2=f1+L1
Loop
Function = Mid$(tStr,1,ti) '提取结果(并删除附加空间)
End Function