Reputation: 4997
Is there any function in vb.net that removes all spaces in a string. I mean a string like ' What is this' should be 'Whatisthis'
Thanks Furqan
Upvotes: 3
Views: 27172
Reputation: 21
I have used str=str.Replace(" ","")
with great success.
However, str=str.Replace(" ","")
has not worked for me in the past.
Upvotes: 2
Reputation: 6986
You could use String.Replace:
Dim str As String = " What is this"
str = str.Replace(" ", "")
Upvotes: 2
Reputation: 131597
Using String.Replace
:
Dim Test As String = "Hello Hi"
Test = Test.Replace(" ", String.Empty)
Upvotes: 1
Reputation: 262919
Use String.Replace()
Dim s As String = " What is this"
s = s.Replace(" ", "")
Upvotes: 10