【C#】 删除首/尾部字符
代码
static void Main(string[] args)
{
string str = "123abc";
string strdelete = "abc";
string str1 = str.Trim('1');
string strc = str1.Trim('c');
string str11 = str1.TrimStart('1');
string strcc = str1.TrimEnd('c');
string strabc = str.Trim(strdelete.ToCharArray());
Console.WriteLine(str1);
Console.WriteLine(str11);
Console.WriteLine(strc);
Console.WriteLine(strcc);
Console.WriteLine(strabc);
Console.ReadLine();
}
结果
原文地址:https://blog.csdn.net/qq_39397927/article/details/137629513
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!