字符串将单引号替换为C#中的双引号

如何在C#中的字符串中用双引号(“)替换单引号(’)?

您需要为引号符号使用正确的转义序列,您可以在此处找到有关转义序列的更多信息。

String stringWithSingleQuotes= "src='http://...';"; String withDoubleQuotes = stringWithSingleQuotes.Replace("'","\""); 
 var abc = "hello the're"; abc = abc.Replace("'","\""); 
 string str; str=strtext.Replace('"','\'');