Sponsored By
Advertise with Us
Advertise with Us
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form

Home >> .Net >> ASP.Net >> Special character remove from url or any string
Author Post

Rajesh Goswami

Total Post: 29
Member Since: 10/19/2010
Points: 151
Special character remove from url or any string
Posted On: 12/6/2010 12:04:08 AM
how we remove the special character from any string 
for example
string sSpecailChar="rajesh have $280.00 Rs. only, What!?"
in this sample how remove the special character like $!.?
is the best solution of this problem
Author Post

Amit Singh

Total Post: 104
Member Since: 8/8/2010
Points: 702
Re: Special character remove from url or any string
Posted On: 12/6/2010 1:01:11 AM
we use regex class which contain many important properties like relace(), split(), match() etc
we remove the special char from any string
for example:
firstly, we use System.Text.RegularExpressions namespce

string strData = "rajesh have $280.00 Rs. only, What!?";
        string pattern = "[^a-zA-Z0-9]+";
        Regex rgx = new Regex(pattern);
        Response.Write("<font color='green'>Before Replace: </font> " + strData+"<br/>");
        Response.Write("<font color='green'>After Repalce: </font>" + rgx.Replace(strData, " "));

Untitled PageBefore Replace: rajesh have $280.00 Rs. only, What!?
After Repalce: rajesh have 280 00 Rs only What
Report Abuse Form
Total Online Users: 4893
MindStick DataConverter
Advertise with Us
Copyright © 2009 - 2014MindStick. All Rights Reserved.