首页 > 代码库 > C# Trim方法去除字符串两端的指定字符

C# Trim方法去除字符串两端的指定字符

var str= ",2,3,4,6,7,";var str2 = str.Trim(new char[] { ‘,‘ }); //去除字符串str两端的‘,‘字符。//则str2 为:"2,3,4,6,7"