by Jonathan (4 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 23rd May 1999
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Another way to find and replace all instances of one string in another (non case-sensitive)
Dim I As Integer
I = 1
Dim LeftPart
Do While True
I = InStr(1, Ucase$(Entire), Ucase$(Word))
'This is case sensitive. To make it not case-sensitive:
'I = InStr(1, Entire, Word)
If I = 0 Then
Exit Do
Else
LeftPart = Left(Entire, I - 1)
Entire = LeftPart & Right(Entire, Len(Entire) - Len(Word) - Len(LeftPart))
End If
Loop
MsgBox Entire
End Sub
Public Sub Form_Load()
RemoveString "StringToSearch", "WordToRemove"
End Sub
No comments have been posted about Another way to find and replace all instances of one string in another (non case-sensitive). Why not be the first to post a comment about Another way to find and replace all instances of one string in another (non case-sensitive).