August 9, 2004
This custom method works for both leading, trailing, and intermingling
spaces...
Private Sub RemoveSpaces()
Dim str() As String
Dim s As String = TextBox1.Text ' get the string to split
str = s.Split(" ") ' split string into array
s = String.Join("", str) ' join it with no character
TextBox1.Text = s ' redisplay string
End Sub
I have already tried this method and it works great!
Joseph MCP
"Paul" wrote:
Hi just wondering if there is an easy way to remove spaces in a string, tried
the trim method but think it is only for leading or trailing spaces.
thanks
--
Paul G
Software engineer.