VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function to remove all occurrences of a string inside another string. Even allows you to do a case

by Anonymous (267 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sun 23rd May 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function to remove all occurrences of a string inside another string. Even allows you to do a case sensitive comparison.

Rate Function to remove all occurrences of a string inside another string. Even allows you to do a case




'Removes all occurences of strRemove from pStr
'ignoreCase tells us to ignore the case when making comparisons

On Error GoTo RemoveStringERR

Dim opStr As String
Dim c As New Collection
Dim s As New clsStringAnalyser
Dim res As Variant

    If IsMissing(ignoreCase) Then
        ignoreCase = True
    End If
    
    c.Add strRemove
    
    res = s.PopWord(pStr, ignoreCase, c)
    
    Do While Not IsNull(res)
        opStr = opStr + res
        res = s.PopWord()
    Loop
    
    RemoveString = opStr
    
RemoveStringEXIT:
    Exit Function
RemoveStringERR:
    RemoveString = Null
    Err.Raise (Err.Number)
    Resume RemoveStringEXIT
End Function

Download this snippet    Add to My Saved Code

Function to remove all occurrences of a string inside another string. Even allows you to do a case Comments

No comments have been posted about Function to remove all occurrences of a string inside another string. Even allows you to do a case . Why not be the first to post a comment about Function to remove all occurrences of a string inside another string. Even allows you to do a case .

Post your comment

Subject:
Message:
0/1000 characters