c#Split如何按逗号分隔或者换行分隔 两个同时判断
c#Split如何按逗号分隔或者换行分隔两个同时判断string[]sArray=sjh.Split(',');foreach(stringsinsArray){if(s...
c#Split如何按逗号分隔或者换行分隔 两个同时判断
string[] sArray = sjh.Split(',');
foreach (string s in sArray)
{
if(s!="" &&s.Length==11)
{
string phonetype=retsjhmdss(s);
switch (phonetype)
{
case "1": Session["ydhm"] = s + "," + Session["ydhm"]; break;
case "2": Session["dxhm"] = s + "," + Session["dxhm"]; break;
case "3": Session["lthm"] = s + "," + Session["lthm"]; break;
}
目的就是万一不是逗号的时候 可以判断是否有回车符 展开
string[] sArray = sjh.Split(',');
foreach (string s in sArray)
{
if(s!="" &&s.Length==11)
{
string phonetype=retsjhmdss(s);
switch (phonetype)
{
case "1": Session["ydhm"] = s + "," + Session["ydhm"]; break;
case "2": Session["dxhm"] = s + "," + Session["dxhm"]; break;
case "3": Session["lthm"] = s + "," + Session["lthm"]; break;
}
目的就是万一不是逗号的时候 可以判断是否有回车符 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询