-1
我的节目是不能够得到的41的索引阵列已经错误索引阵列出它是由逗号其是41个逗号时,我的确得到了40我没有遇到的错误分离,但当涉及到41的逗号它给了我一个错误索引数组outbound是否有任何限制在字符串数组和热最大化它。字符串数组最大仅在40
CSVReader reader = new CSVReader(new FileReader(source1));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
String[] string = nextLine[0].split(",");
System.out.println(string.length);
if(string.length>=4){
System.out.println(string[0]);
System.out.println(string[1]);
}
请发表[MCVE。 – shmosel
你最好仔细检查你的csv文件的行,尤其要注意空字符......你可以输出nextLine的** length **来检查和调试。 – HappyHal
数组的第一个元素编号为0.第41个元素的编号为40.第42个元素的编号为41.也许您只有41个元素。 –