如何用\“"替换字符串使用C#的字母s [英] How to String replace with \" with letter s using C#

查看:116
本文介绍了如何用\“"替换字符串使用C#的字母s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我需要用字母s替换字符串\.
我不需要这个mstring.Replace("\","s");
mystring.Replace("\"," s);
请帮助我
谢谢

Hi I need to replace string \" with letter s.
I dont need this mstring.Replace("\","s");
mystring.Replace("\"","s");
please help me
Thanks

推荐答案

尝试:
myString = myString.Replace("\\\"", "s");


myString = myString.Replace(@"\""", "s");

任何一个都应该这样做

或者(如果您对String过敏,请替换),然后总会有Regexes:

Either should do it

Or (if you are allergic to String.Replace perhaps) then there are always Regexes:

myString = Regex.Replace(myString, "\\\\\"", "s");



如果那不是您想要的,那么您需要更详细地解释.



If that isn''t what you want, then you need to explain in more detail.


这篇关于如何用\“"替换字符串使用C#的字母s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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