开发者

string replace single quote to double quote in C#

开发者 https://www.devze.com 2023-02-14 13:59 出处:网络
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 e

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

精彩评论

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