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]; }