用途:去除尾部的指定字符。
ex1:string a="c:/temp/";
string b=a.trimEnd('/');
此时b就是:"c:/temp"
ex2:string textStr = "";
foreach (ListItem item in list.Items)
{
if (item.Selected)
{
textStr += item.Text + ",";
}
}
if (textStr.Length > 0)
{
textStr = textStr.TrimEnd(',');
}
msdn参考地址:http://msdn.microsoft.com/zh-cn/library/system.string.trimend.aspx