<分区>
如果我有字符串,并且我想用星号替换该字符串中的最后一个字符。
我试过了
var myString = "ABCDEFGH";
myString.ReplaceCharacter(mystring.Length - 1, 1, "*");
public static string ReplaceCharacter(this string str, int start, int length, string replaceWith_expression)
{
return str.Remove(start, length).Insert(start, replaceWith_expression);
}
我尝试使用此扩展方法,但这不起作用。 为什么这不起作用?