by Brian Gillham (7 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (6 Votes)
VB forgot to add a Function strip out all those LEADING, TRAILING and EXTRA spaces in ONE Function.
I have seen many attempts at doing this but think mine does it in the least amount of code.
Note:
Inputs
String eg:Strip
Code Returns
Strip
Public Function TrimALL(ByVal TextIN As String) As String
TrimALL = Trim(TextIN)
While InStr(TrimALL, String(2, " ")) > 0
TrimALL = Replace(TrimALL, String(2, " "), " ")
Wend
End Function