开发者

string replace single quote to double quote in C#

How c开发者_高级运维an I replace a single quote (') with a double quote (") in a string in C#?


You need to use the correct escape sequence for the quotes symbol, you can find more information about escape sequencies here.

String stringWithSingleQuotes= "src='http://...';";
String withDoubleQuotes = stringWithSingleQuotes.Replace("'","\"");


var abc = "hello the're";
abc = abc.Replace("'","\"");


string str;
str=strtext.Replace('"','\'');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜