public static void main(String[] args) { //创建一个逗号分割的字符串 String cdids="0000,1111,2222,3333,4444,5555,6666,7777,8888,9999"; //利用split进行分隔为数组 String[] cdid = cdids.split(","); //保留数组格式输出 String s = JSONUtil.toJsonStr(cdid); System.out.println(s); //for循环遍历数组 for (int i = 0; i < s.length();i++) { String s1 = cdid[i]; System.out.println(s1); } }