public string Trim(params char[] trimChars);
View Code
1 static void Main(string[] args) 2 { 3 //去掉两端的空格和指定的元素 4 string str = " 11178978978978979878978971111 "; 5 string delim = " 1"; 6 str=str.Trim(delim.ToCharArray()); 7 Console.WriteLine(str); 8 Console.ReadKey(); 9 10 //This code example displays the following:7897897897897987897897 11 }