Live Chat Icon For mobile
Live Chat Icon

How to remove the spaces in a given string?

Platform: ASP.NET| Category: Miscellaneous

Use the Namespace System.Text.RegularExpressions
VB.NET


Dim strval As String = 'Jack and Jill'
Dim strnewval As String = Regex.Replace(strval, ' ', '')
Response.Write(strnewval)

C#


string strval    = 'Jack and Jill';
string strnewval    = Regex.Replace(strval, ' ', '');
Response.Write(strnewval)	;

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.