【发布时间】:2021-04-04 05:55:29
【问题描述】:
因此,从字符串中修剪某些内容的正常方法是按字符修剪它。
例如:
string test = "Random Text";
string trimmedString = test.Trim(new Char[] { 'R', 'a', 'n'});
Console.WriteLine(trimmedString);
//the output would be "dom Text"
但不是这样做,有没有办法从字符串中完全删除组合字符“Ran”?
例如:
string test = "Random Text";
string trimmedString = test.Trim(string "Ran");
Console.WriteLine(trimmedString);
//the output would be "dom Text"
现在,上面的代码出错了,但是想知道这样的事情是否可能,谢谢!
【问题讨论】:
-
string.Replace() ....docs.microsoft.com/en-us/dotnet/api/…