C#正则表达式之字符替换!...

string strTest= "www.BaiDu.com",strRst="";

            //忽略大小写,将strTest中的BaiDu替换为baidu
            Regex myRegex = new Regex("baidu",RegexOptions.IgnoreCase);
            strRst=myRegex.Replace(strTest,"baidu");


            Console.WriteLine("\n替换前的字符串为:"+strTest);
            Console.WriteLine("\n替换后的字符串为:"+strRst);
            Console.WriteLine();

            Console.WriteLine(The_Day.getTheDay()+" By yxHuang!...");

            //暂停,用于查看效果 
            Console.Read();



posted @ 2012-04-11 21:39  氺〤魚Oo。  阅读(236)  评论(0编辑  收藏  举报