string htmlContent = "第一|第二|第三"; string[] sArray = htmlContent.Split('|'); int count = 0; foreach (string i in sArray) { count++; if (count == sArray.Length) { Response.Write("最后一个"); } }