Having some issues doing some coding work for a java class of mine. The program is supposed to read an file, split the lines into segments, replaces the lines if blank/empty and then reassemble the line.
The info in the file looks something like:
Jeffrey,Brandon,brand1jd,957030
Kayla,Neff,neff1km,736165
Michael,Wilson,wilso2mw,875541
The main issue I've been trying to wrap my head around is the fact that one of the lines in the file looks something like this:
Test,student,seeli1p_s,
Which the coding i have set up should recognize lacks a 4th segment and should place a "0" as the missing value in the array, yet it currently refuses to pick up that last value for the array. So I continually get a "ArrayIndexOutOfBoundsException" on that line and only that line of input.
Any ideas/hints as to how to fix/recode this so that it will recognize that the line missing a number at the end needs a "0" there.
You will see it returns an array of sub strings. If the string to split only contains 3 parts the returned array will only have a size of 3 so you can't add 0 to the forth element without resizing the array.
Bookmarks