替换“"到C#中的'' [英] Replace "" to '' in c#
本文介绍了替换“"到C#中的''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下面的代码:
this.TextBox1.Text = this.TextBox1.Text.Replace("""","''''");
我想将"替换为",但代码不接受.
请帮助我.
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.
推荐答案
你好,
请尝试以下操作:
Hello,
Try the following:
this.TextBox1.Text = this.TextBox1.Text.Replace("\"\"","''''");
Regards,
您不能将字符串指定为(""),因为"表示字符串的结尾.
将"替换为"\".
You cannot specify the string as ("""") as '' " '' represents end of a string.
replace '' " '' with '' \" ''.
textBox1.Text.Replace("\"\"","''")
编译...您是否已阅读错误?
看一下:字符串转义:引号 [
That wouldnt even compile... have you read the error?
Take a look at: String Escape: quote[^].
这篇关于替换“"到C#中的''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文