using System; using System.Collections.Generic; using System.Text; namespace ZWL.Common { public class StringPlus { public static string[] GetStrArray(string str) { return str.Split(new char[',']); } public static string GetArrayStr(List list,string speater) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (i == list.Count - 1) { sb.Append(list[i]); } else { sb.Append(list[i]); sb.Append(speater); } } return sb.ToString(); } #region 删除最后一个字符之后的字符 /// /// 删除最后结尾的一个逗号 /// public static string DelLastComma(string str) { return str.Substring(0, str.LastIndexOf(",")); } /// /// 删除最后结尾的指定字符后的字符 /// public static string DelLastChar(string str,string strchar) { return str.Substring(0, str.LastIndexOf(strchar)); } #endregion } }