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