Removing any Blank Spaces from any given String.

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1019
First,Import Namespace as System.Text.RegularExpressions,Here we will use Regular Expression' Replace Method which takes 3 parameters as
First param - Input value
Second param - Pattern
Third param - Replacement value

and is used to Remove Blank Spaces from any String as:-
Suppose we have a string called Welcome to Dot Net Funda . Com,then refer below code as:-
string old_value = "Welcome to Dot Net Funda . Com";
string new_value = Regex.Replace(old_value, " ", "");
Response.Write(new_value);
Output would be:-
WelcometoDotNetFunda.Com

Comments or Responses

Login to post response