VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



String Replacement with recursive function

by Alexandros Zountas (2 Submissions)
Category: String Manipulation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 29th September 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

String Replacement with recursive function

Rate String Replacement with recursive function



You can also use VBs Replace Function

Public Function RepString(Expression As String, Find As String, Replace As String) As String
Dim i As Integer, j As Integer

For i = 1 To Len(Expression) Step Len(Find)
    j = InStr(1, Expression, Find)
    If j > 0 Then
        RepString = Left(Expression, j - 1) & Replace & RepString(Mid(Expression, j + Len(Find)), Find, Replace)
    Else
        RepString = Expression
    End If
Next i
End Function


Download this snippet    Add to My Saved Code

String Replacement with recursive function Comments

No comments have been posted about String Replacement with recursive function. Why not be the first to post a comment about String Replacement with recursive function.

Post your comment

Subject:
Message:
0/1000 characters