I'm attempting to read a text file with Scanner dataFile = new Scanner("FileName.txt");
the text file has lines which are supposed to be read for info on them. I'm using:
while(dataFile.hasNext()){
String line = dataFile.nextLine();
...
}
to loop through the lines. I need to extract a String at the start of the line, an Integer after the String, and a Double after the Integer. They have spaces in-between each part I need to extract so I am willing to \ make a substring search through the line to individually search for the parts in the line.
I am wondering, Is there an easier and quicker method to doing this?
Example contents of text file:
Name 10 39.5
Hello 75 87.3
Coding 23 46.1
World 9 78.3