如何在C#中替换字符 [英] How Do I Replace Character In C#

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

问题描述

只是我想将这个'\ 00C7'字符替换为'M'。



i尝试过这种方式,但它无效。

just i want to replace this '\00C7' characters to 'M'.

i have tried this way but its not working.

string s = xDoc.SelectSingleNode("//s1").InnerText; //s=C\00C7TCH
string v= sCompanyNameG.Replace("\00C7", "A");





任何解决方案。



any solution for this.

推荐答案

你需要正确转义unicode并用M代替A.

You need to proper escape unicode and replace the A by M.
string v= sCompanyNameG.Replace("\u00C7", "M");



祝你好运!


Good luck!


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

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