从字符串的字符消除 [英] Eliminating characters from string

查看:130
本文介绍了从字符串的字符消除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文件中读取,以及一些数据是在正在添加这样

I am reading from a file, and some of the data is comming in like this

"\"ZIP\""

所以当我试图给它分配其造成的错误,我想摆脱掉多余的 \\,所以如果我把它分配给任意字符串如

so when i try to assign it its causing errors, i want to get rid off the extra \", so if I assign it to as string like

string s = data[1].ToString();

什么取值\\ZIP \\

我只是希望它是ZIP,我想:

i just want it to be "ZIP", i tried:

string s = data[1].ToString().replace("\\\"","");

但没有运气。任何帮助将是非常美联社preciated。

but no luck. Any help would be much appreciated.

推荐答案

只是尝试:

var result = "\"ZIP\"".Replace("\"", "");

或者

 var result = "\"ZIP\"".Trim('"');

这篇关于从字符串的字符消除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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