Reading part of a line in a text file
Hi all, I want to read from a text file and pass each line of that file into an array of objects.
Here's the text file format:
I have created a class "Student" that has instance variables of:
Result results = new Result;
The Result class is made up of "courseCode" and "result". So you can see that the text file has the first four values as primatives and the last three values as Result Objects.
I've used a Scanner to read from similar text files to instantiate other objects, so that part is not my problem.
What I need to do is firstly create and array just consisting of the results from the text file(deliniated by a "-") and then pass that array into the Student constructor.
How do I only read the results values of the text file, that is, skip the 12345678:Aaron:Simons:Y and just read the COSC1070-55:COSC1071-56:COSC07298-89. Also, if each of the text file values id deliniated by a (":"), and within the result value, the two parts are deliniated by a ("-"), how do I just pick out the String "COSC1070" and the Integer "55" and pass those values into the result array?
Hope someone can help, thanks