-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個元素。 –