Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Take away spaces in a string

Status
Not open for further replies.

don2241

IS-IT--Management
Jun 1, 2001
57
AU
Hi!

How can I trim a string to take away spaces.
For example: "000 000 000 000" I want it to look like "000000000000"
The Trim function only takes away spaces in the begining and the end of the string.

Thanks
/M.
 
Replace("000 000 000 000"," ","")
 
Not very ellegant but it works:-

Dim TempString As String, i As Integer
YourString = "000 000 000 000"
TempString = ""

For i = 1 To Len(YourString)
If Mid(YourString, i, 1) <> Chr(32) Then
TempString = TempString & Mid(YourString, i, 1)
End If
Next i

YourString = TempString
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top