用逗号分隔的数据转换到数组

string disIds = "1,2,3,4,5,6,7,8,9,";
string[] filePath = disIds.Split(',');

//去掉最后一位空值
string[] filePath2 = new string[filePath.Length - 1];
     for (int i = 0; i < filePath.Length-1; i++)
     {
         filePath2[i] = filePath[i];
     }

 

posted @ 2015-12-21 18:52  时代码农  阅读(1569)  评论(0编辑  收藏  举报