C# 中 string 对象的 Replace 语法是:
string string.Replace(string oldValue, string newValue)
我们可能常常忘了应用其返回值,比如:要将 str 中的 "1" 替换成 "2",下面的做法是不正确的:
str.Replace("1", "2");
正确的做法是:
str = str.Replace("1", "2");
创建于2005年 渝ICP备05010272号-1
电邮:cftea@126.com