日期:2014-05-17  浏览次数:21058 次

c# 标点问题
  Session["ESI_EMPNO"] = Session["ESI_EMPNO"] + l_dtDaTable2.Rows[i]["ESI_EMPNO"].ToString();

得到的结果是“9009903090629063”

我想得到“‘9009’,‘9030’,‘9062’,‘9063’”

怎么改?

------解决方案--------------------
%4==0   
+","
TrimEnd(',')
------解决方案--------------------
string strNum="90099030906290631";
            string res ="";
            int i = 0;
            while (i+4 < strNum.Length)
            {
                res += strNum.Substring(i, 4) + ",";
                i = i + 4;
            }
------解决方案--------------------
string text = @"9009903090629063";
            List<string> list = Regex.Split(text,@"(?<=\G\w{4})(?!$)").ToList();
            /*
             *  [0] "9009" string
            [1] "9030" string
            [2] "9062" string
            [3] "9063" string

             */

------解决方案--------------------
引用:
Quote: 引用:

string text = @"9009903090629063";
            List<string> list = Regex.Split(text,@"(?<=\G\w{4})(?!$)").ToList();
            /*
             *  [0] "9009" string
            [1] "9030" string
            [2] "9062" string
            [3] "9063" string

         &nbs