日期:2014-05-18 浏览次数:20514 次
void Main() { string str="ABC F J"; Regex reg=new Regex("\\s+"); str=reg.Replace(str,"",1); Console.WriteLine(str); //ABCF J }
------解决方案--------------------
str=str.Remove(3,1);
------解决方案--------------------
string str="A,B,C,,F,J"; string[] s = str.Split(','); IList list = new ArrayList(); for (int i = 0; i < s.Length; i++) { if (s[i]!="") { list.Add(s[i]); } } for (int k = 0; k < list.Count; k++) { Response.Write(list[k] + ","); }