如何更换的"出现; - "用空字符串? [英] How to replace occurrences of "-" with an empty string?
本文介绍了如何更换的"出现; - "用空字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的字符串:123-456-7
我需要得到这个字符串:1234567
我怎么能代替的发生 - ?用一个空字符串
解决方案
串R =123-456-7;
R = r.Replace( - ,);
I have this string: "123-456-7"
I need to get this string: "1234567"
How I can replace occurrences of "-" with an empty string?
解决方案
string r = "123-456-7";
r = r.Replace("-", "");
这篇关于如何更换的"出现; - "用空字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文