用C#替换转义字符 [英] Replace escape charaters in C#

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

问题描述

大家好,



我想用D:\ 152.15.945.12替换D:\ Dashboard,BUt问题是我是得到意外的特征错误。我知道我们应该使用D:\\Dashboard ..但是我的实际需要是在html文件中找到字符串并且应该用新地址替换...请帮我解决这个问题。



谢谢和问候,

Hi all,

I want to replace "D:\Dashboard" with "D:\152.15.945.12", BUt the problem is i am getting unexpected charater error. I know we should use D:\\Dashboard.. but my actual need is find the the string in a html file and should replace with the new address... Please help me out in this.

Thanks and Regards,

推荐答案

使用 @

你可以简单地做到这一点...

use of @
you can simply do this...
string a = @"D:\Dashboard    D:\\Dashboard";
a = a.Replace(@"D:\Dashboard",@"D:\152.15.945.12").Replace(@"D:\\Dashboard",@"D:\152.15.945.12");



快乐编码!

:)


Happy Coding!
:)


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

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