VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Replace the string with the given character

by Sathyanarayanan.k (3 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 13th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Replace the string with the given character

Rate Replace the string with the given character




    Dim iCount                  As Integer
    Dim sInput                  As String
    sInput = vsInput
    iCount = InStr(sInput, vsReplace)

    While iCount
        sInput = Left$(sInput, iCount - 1) & vsWith & Right$(sInput, Len(sInput) - iCount)
        iCount = InStr(sInput, vsReplace)
    Wend

    Replace = sInput

End Function

Download this snippet    Add to My Saved Code

Replace the string with the given character Comments

No comments have been posted about Replace the string with the given character. Why not be the first to post a comment about Replace the string with the given character.

Post your comment

Subject:
Message:
0/1000 characters