c# 去除字符串中的某个已知字符
关键字:Replace;字符串中去除某个字符,可以理解成把想要去除的字符换成"";
去除已知字符:
public static void Main(string[] args)
{
去除字符串中的“b”
string str = "abc123";
string result = str.Replace("b","");
Console.WriteLine(result);
}
结果:ac123