去除字符串头尾的指定字符

var MyString = "******中华人民共和国******_";
var Myinfo = MyString.Trim("*".ToCharArray());
var Myinfo1 = MyString.Trim(new char[2] { '*', '_' });
Response.Write(MyString + "\n" + Myinfo+"\n"+Myinfo1);

******中华人民共和国******_

中华人民共和国******_

中华人民共和国

原文地址:https://www.cnblogs.com/Yellowshorts/p/2913577.html