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