VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Removes multiple duplicate spaces within strings

by ratnala (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 24th June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Removes multiple duplicate spaces within strings

Rate Removes multiple duplicate spaces within strings



        Const Space = " "
        Dim inPos As Long
        stInput = Trim$(stInput)
        inPos = InStr(1, stInput, Space, vbBinaryCompare)
        Do While inPos > 0
            stInput = Left$(stInput, inPos) & LTrim$(Right$(stInput, Len(stInput) - inPos))
            inPos = InStr(inPos + 1, stInput, Space, vbBinaryCompare)
        Loop
        SquishMultiSpaces = stInput
 End Function

Download this snippet    Add to My Saved Code

Removes multiple duplicate spaces within strings Comments

No comments have been posted about Removes multiple duplicate spaces within strings. Why not be the first to post a comment about Removes multiple duplicate spaces within strings.

Post your comment

Subject:
Message:
0/1000 characters