QTP中字符串替换函数
生活随笔
收集整理的這篇文章主要介紹了
QTP中字符串替换函数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Function Replace_ex (ExPression, Find, Replace_tmp)
Dim i, j, s , s1
s = LCase(ExPression) '統一轉換為小寫,表示不區分大小寫
Find = LCase(Find) '同上
i = 1
Do While InStr(i, s, Find, vbBinaryCompare) > 0 '查找
j = InStr(i, s, Find, vbBinaryCompare)
s1 = s1 + Mid(ExPression, i, j - i) + Replace_tmp '替換
i = j + Len(Find)
Loop
If i <= Len(ExPression) Then s1 = s1 + Mid(ExPression, i)
Replace_ex = s1 '輸出
End Function 與50位技術專家面對面20年技術見證,附贈技術全景圖
Dim i, j, s , s1
s = LCase(ExPression) '統一轉換為小寫,表示不區分大小寫
Find = LCase(Find) '同上
i = 1
Do While InStr(i, s, Find, vbBinaryCompare) > 0 '查找
j = InStr(i, s, Find, vbBinaryCompare)
s1 = s1 + Mid(ExPression, i, j - i) + Replace_tmp '替換
i = j + Len(Find)
Loop
If i <= Len(ExPression) Then s1 = s1 + Mid(ExPression, i)
Replace_ex = s1 '輸出
End Function 與50位技術專家面對面20年技術見證,附贈技術全景圖
總結
以上是生活随笔為你收集整理的QTP中字符串替换函数的全部內容,希望文章能夠幫你解決所遇到的問題。