C#删除末尾的多个指定字符

   String str1 = "*;|@123***456@|;*";
String delim = "*;|@";
String str2 = str1.Trim(delim.ToCharArray());
        String str3 = str1.TrimEnd(delim.ToCharArray());
 Console.WriteLine("Trimmed string:  {0}", str2);

 Console.WriteLine("Trimmed string:  {0}", str3);

结果是:

123***456

*;|@123***456

你可能感兴趣的:(String,C#)