【发布时间】:2011-07-08 12:54:40
【问题描述】:
如何在 C# 中将字符串中的单引号 (') 替换为双引号 (")?
【问题讨论】:
如何在 C# 中将字符串中的单引号 (') 替换为双引号 (")?
【问题讨论】:
您需要为引号符号使用正确的转义序列,您可以找到更多关于转义序列的信息here。
String stringWithSingleQuotes= "src='http://...';";
String withDoubleQuotes = stringWithSingleQuotes.Replace("'","\"");
【讨论】:
var abc = "hello the're";
abc = abc.Replace("'","\"");
【讨论】:
string str;
str=strtext.Replace('"','\'');
【讨论】: