VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Removes duplicate spaces within strings.

by Kevin D. Sandal (2 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 9th April 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Removes duplicate spaces within strings.

Rate Removes duplicate spaces within strings.




    Const TWO_SPACES As String = "  "
   
    Dim intPos As Integer
    Dim strTemp As String
   
    intPos = InStr(1, strText, TWO_SPACES, vbBinaryCompare)
    Do While intPos > 0
        strTemp = LTrim$(Mid$(strText, intPos + 1))
        strText = Left$(strText, intPos) & strTemp
        intPos = InStr(1, strText, TWO_SPACES, vbBinaryCompare)
    Loop
   
   SquishSpaces = strText   

End Function


Download this snippet    Add to My Saved Code

Removes duplicate spaces within strings. Comments

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

Post your comment

Subject:
Message:
0/1000 characters