简体   繁体   English

用双引号 ('') 替换单引号 (')

[英]Replace a single quote ( ' ) with double quote ( ' ')

I am trying to replace a single quote ( ' ) with a double quote ( ' ' ) and not with this character : ( " )我试图用双引号( ' ' )而不是用这个字符替换单引号( ' ):( " )

Actually, I am trying this :实际上,我正在尝试这个:

Text.Replace("'", "''");
Text.Replace("'", "\''");
Text.Replace("\'", "''");
Text.Reaplce("\'", "\''");

But none of this does works...但这一切都不起作用......
I am willing to do this and am really demanding it, so it would be great if you could help me我愿意这样做并且真的很苛刻,所以如果你能帮助我就太好了

You can just use Replace("'", "''");你可以只使用Replace("'", "''"); . . However keep in mind that the Replace method returns a new string.但是请记住, Replace方法返回一个新字符串。 So it has to be:所以它必须是:

Text = Text.Replace("'", "''");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM