该函数在字符串 s 中清除 Search(注意:如果 s 为 AAABBB,Search 为 AB。如何?) :

 

Function StringCleaner(s As String, Search As String) As String

Dim i As Integer, res As String

res = s

Do While InStr(res, Search)

i = InStr(res, Search)

res = Left(res, i - 1) & Mid(res, i + 1)

Loop

StringCleaner = res

End Function