一篇文章中输入关键字,抓取出来修改,并替换

try
            {
                string s = "巴塞罗那获得了欧冠冠军,皇马很忧伤!";
                string n = "在伯纳乌球场,球迷们高呼巴塞罗那是冠军!";

                Console.WriteLine("请输入一个关键字");
                string g = Console.ReadLine();

                s = s.Replace(g, "(" + g + ")");
                n = n.Replace(g, "(" + g + ")");

                Console.WriteLine(s);
                Console.WriteLine(n);
            }
            catch (Exception)
            {

                Console.WriteLine("该关键字未查到!");
            }

原文地址:https://www.cnblogs.com/franky2015/p/4634363.html