How to remove all spaces from a string using Regex in VB.NET

1 Answer

0 votes
Imports System
Imports System.Text.RegularExpressions

Public Class Program
	Public Shared Sub Main()
		Dim str As String = "Remove all spaces from string in VB.NET"
		
        str = Regex.Replace(str, "\s+", "")
		
        Console.Write(str)
    End Sub
End Class



' run:
'
' RemoveallspacesfromstringinVB.NET
'

 



answered Nov 10, 2022 by avibootz

Related questions

1 answer 122 views
1 answer 143 views
1 answer 121 views
2 answers 352 views
1 answer 126 views
1 answer 150 views
...