VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 查找替代字符串的例子
发表评论(0)作者:, 平台:, 阅读:13049, 日期:2000-03-12
查找替代字符串的例子

Function sReplace(SearchLine As String, SearchFor As String, ReplaceWith

As String)

Dim vSearchLine As String, found As Integer

found = InStr(SearchLine, SearchFor): vSearchLine = SearchLine

If found< 0 Then

vSearchLine = ""

If found >1 Then vSearchLine = Left(SearchLine, found - 1)

vSearchLine = vSearchLine + ReplaceWith

If found + Len(SearchFor) - 1
vSearchLine = vSearchLine + Right$(SearchLine, Len(SearchLine) - found -

Len(SearchFor) + 1)

End If

sReplace = vSearchLine

End Function