Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I'm parsing csv file with java and store in jtable, but i have some problem.
When read one row, I store the row in string and separate by comma.
The csv file have 13 columns. Now when the last column is empty my program crush with index out of bounds(this is not problem when some other column is empty, just problem when the last column is empty).

I've tried to replace '\0' with ' ', but won't help.

I need help how to read null value from last column.

Thanks, Cheers

http://i.imgur.com/Ea2thLb.png[^]
Posted
Comments
Shubhashish_Mandal 27-Sep-13 3:20am    
post the code of splitting the string

1 solution

Use http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html[^]. This allows you to check whether there are any more tokens in the string, so you can know when the last item is null.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900