split in java for csv file with random content for last field -


split in java csv file last field content including splitter symbol. sample input line.

2010-10-06 09:02:10,498 [renderingqueue] info [renderingqueue]: waiting next command... . ..

so far used blank separator (6 fields, 5 separations) .
thought separating on blank fine untill last field (6) after - - [renderingqueue]: ---- ( = field 5) field 6 should contain afterwards. in sample line field 6 contains "waiting next command..." . field 6 can contain blanks , semicolon, double point,words , : etc.. of length . split statement specify 5 splits , afterwards in field 6 .
beforehand.

my code :

while ((line = br.readline()) != null) { 

// // split line array of 1 dimension string [] splittedline = new string [6];

                splittedline = line.split(" ",5);                 //                 // show content in console (for test purposes)                 //                 for(int i=0; i<5; i++){                 system.out.println(splittedline[i]);                 }                 // 

my code causes error : exception in thread "main" java.lang.arrayindexoutofboundsexception: 5 @ project1.readlogbook.main(readlogbook.java:74)


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -