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

【请教】去掉string里面指定的字符?
string   str=   “abcde[fg]”

怎样去掉[,],   使其变为“abcdefg”?

------解决方案--------------------
str.Replace( "[ ", " ");
str.Replace( "] ", " ");
------解决方案--------------------
str.Replace( "[ ", " ");
str.Replace( "] ", " ");



看帮助哈
faint!
------解决方案--------------------
regex.replace(str,@ "[\[\],] ", " ")
正则表达式
------解决方案--------------------
str.Replace( "[ ", " ");
str.Replace( "] ", " ");

可以