Sponsored By
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Article
Forum
Blog
Quiz
Beginner
Careers
Contact
Login
Email Id
Password
Remember Me
Forgot Password?
Sign Up
Home
|
Product
|
Services
|
About Us
|
Interview
|
DeveloperSection
|
Submit an Article
|
Submit Blog
Report Abuse Form
Reason:
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
Report Abuse
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
Reply
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
Report Abuse
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, " "));
output:
Untitled Page
Before Replace:
rajesh have $280.00 Rs. only, What!?
After Repalce:
rajesh have 280 00 Rs only What
Reply
Report Abuse Form
Reason:
Total Online Users:
2684
Advertisement
Advertise with Us
Copyright ©
2013
MindStick. All Rights Reserved.
Home
|
Contact Us
|
Services
|
Feedback
|
Advertisement
|
Privacy Policy
|
Term & Conditions
|
About Us