how can i delete all spaces from a string ?
for example: if i have - h e l l o w o r l d
and i want to make of it: helloworld
how can i do that ?
Printable View
how can i delete all spaces from a string ?
for example: if i have - h e l l o w o r l d
and i want to make of it: helloworld
how can i do that ?
'replace function in VB6
'find an instance and replace it with another
Private Sub Form_Load()
string1 = "h e l l o w o r l d
MsgBox string1
string2 = Replace(string1, " ", "")
'String1 is now "helloworld"
MsgBox string2
End Sub
my mistake, i did not ask the question right.
i need to delete only spaces befor and after the string.
the ones in the middle should stay.
for example:
[ hello world ]
will be:
[hello world]
how can i do that ?
Code:myStr = " Hello World "
myStr = Trim$(myStr)
Use the trim function