Click here to Skip to main content
16,019,764 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a code bellow:
this.TextBox1.Text = this.TextBox1.Text.Replace("""","''");
i want to replace "" to '' but code don,t accept.
please help me.
Posted

Hello,

Try the following:

this.TextBox1.Text = this.TextBox1.Text.Replace("\"\"","''");


Regards,
 
Share this answer
 
You cannot specify the string as ("""") as ' " ' represents end of a string.
replace ' " ' with ' \" '.

C#
textBox1.Text.Replace("\"\"","''")
 
Share this answer
 
That wouldnt even compile... have you read the error?
Take a look at: String Escape: quote[^].
 
Share this answer
 
v2
if u want to replace space there then
this.TextBox1.Text = this.TextBox1.Text.Replace(" ", string.empty);

try out this it will solve ur prob.
 
Share this answer
 
Hi hoa20101988,

I accept with the previous answer but I want to explain the reason :

There is some symbols which can not be written as it is between the quotes like
", /, \, ', enter key, tab key and others where you have to put before them: \
enter key would be \n , tab key \t
when you you are writting it as string between 2 quotes.

this link[^] can give you more information.

I hope this help,
:)
 
Share this answer
 

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