Hello,
I am trying to read in a tab delimited text file. Most lines in the file are in the following format:
Col1 Col2 Col3
data1 data2 data3
data1 data2 data3
But some lines are missing the first value:
Col1 Col2 Col3
data1 data2 data3
data2 data3
data1 data2 data3
I trying to parse each line with the following code:
line = new Scanner(scanner.nextLine());
line.useDelimiter("\t");
variable = line.next();
However, this does not work in cases where the value for the first column is missing. In such cases everything will be off by one.
Meaning, I will be getting the value for col2 where I should be getting the value for col1; and I will be getting the value for col3 where I should be getting the value for col3(so on and so on).
Has someone encountered this problem before? Would someone make a suggestion regarding how solve this problem?