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.
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