c#字符串练习
1,分出字符串
protected void Button1_Click(object sender, EventArgs e) { //把一个字符串按|号分出来输出,但不输出掉空格 string a = "a|b||||c||d"; StringBuilder sb=new StringBuilder (); string[] ss = a.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ss.Length; i++) { sb.Append(ss[i]); } Response.Write(sb); }