日期:2014-05-18  浏览次数:20374 次

字符替换
比如从SQL里面查询出一条数据 string str="asdasdsadasd$sdsadsadsad#asfasfsafsasf@grgrr";
现在我想用:1替换$,2替换#,3替换@

我该怎么做?

做好代码解说清楚直白

------解决方案--------------------
str = str.Replace("$", "1");
str = str.Replace("#", "2");
str = str.Replace("@", "3");

这样貌似可以
------解决方案--------------------
探讨

str = str.Replace("$", "1");
str = str.Replace("#", "2");
str = str.Replace("@", "3");

这样貌似可以

------解决方案--------------------
str = str.Replace("$", "1").Replace("#", "2").Replace("@", "3");