Replace 字符串替换

单个替换:
string str = "aaaaaaa#bbbbbb#aaaaaa";
替换#bbbbbb#为cccccc
String ii = str.Replace("#bbbbbb#", "cccccc");
MessageBox.Show(ii.ToString());

多重替换:
string str="aaaaa#bbbbb#aaaaaa#cccccc#aaaaa";
替换#bbbbbb#为dddddd
        #ccccccc#为eeeeeee
String ii = str.Replace("#bbbbbb#", "dddddd").Replace("#ccccccc#", "eeeeeee");
MessageBox.Show(ii.ToString());


posted @ 2007-07-10 18:07  jenner  阅读(305)  评论(0编辑  收藏  举报