例:
在聊天室中经常遇到屏蔽脏话功能,完成当用户输入一句话中带有“sb”,则将“sb”替换成“**”

Console.WriteLine("请输入一句带有sb的话:");
            string rep = Console.ReadLine();
            string a = rep.Replace("sb", "**");
            Console.WriteLine(a);
            Console.ReadLine();
posted on 2019-01-28 17:54  豆皮没有豆  阅读(1034)  评论(0)    收藏  举报