VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



search and replace one string with another, will handle multiple instances of search string

by Nick Hayday (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 15th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

search and replace one string with another, will handle multiple instances of search string

Rate search and replace one string with another, will handle multiple instances of search string



' this code was adapted from someone else's on VBcode

Function RemoveString(Entire As String, Word As String, Replace As String)
    Dim I As Integer
    I = 1
    Dim LeftPart
    Do While True
        I = InStr(1, Entire, Word)
        If I = 0 Then
            Exit Do
        Else
            LeftPart = Left(Entire, I - 1)
            Entire = LeftPart & Replace & Right(Entire, Len(Entire) - Len(Word) - Len(LeftPart))
        End If
    Loop
    
   MsgBox Entire
   
End Function

Download this snippet    Add to My Saved Code

search and replace one string with another, will handle multiple instances of search string Comments

No comments have been posted about search and replace one string with another, will handle multiple instances of search string. Why not be the first to post a comment about search and replace one string with another, will handle multiple instances of search string.

Post your comment

Subject:
Message:
0/1000 characters