版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wtxhai/article/details/88688997
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Example607_01
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("————模拟实现word的全部替换功能!————");
Console.Write("请输入原始的字符串:");
string str1 = Console.ReadLine(); //输入原始字符串
Console.Write("请输入要查找的字符串:");
string str2 = Console.ReadLine(); //输入要查找的字符串
Console.WriteLine("输入要替换的字符串:");
string str3 = Console.ReadLine(); //获取要替换的字符串
string new1 = str1.Replace(str2, str3);
Console.WriteLine("替换后的字符串是:" + new1);
Console.ReadLine();
}
}
}