字符串替换单引号在C#双引号 [英] string replace single quote to double quote in C#

查看:883
本文介绍了字符串替换单引号在C#双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎能取代单引号(')用双引号()的字符串在C#?

How can I replace a single quote (') with a double quote (") in a string in C#?

推荐答案

你需要使用引号符号正确的转义序列,你可以找到逃生sequencies 这里更多信息< 。/ A>

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("'","\"");

这篇关于字符串替换单引号在C#双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆