Click here to Skip to main content
15,910,009 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to replace single quote into double in ASP.NET?

I have tried:
C#
string a=textbox1.text.replace("'",""");
it is
It says: error - ; expected
Posted
Updated 8-Sep-10 8:11am
v2

Because " is used to delimit strings (and ' for individual characters)
Try using
string a=textbox1.text.replace('\'','\"');

This will also work
string a=textbox1.text.replace('\'','"');
 
Share this answer
 
Comments
Debby Ummul 28-Aug-13 9:01am    
I also trying it,,,and the result is success...
thank yoy :D
Try using escape sequence ('\')(back slash):
C#
string a=textbox1.text.replace("'","\"");
 
Share this answer
 
v2
Comments
Dalek Dave 8-Sep-10 15:51pm    
Yep, that's it!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900