I have a txt file which has several rows like this
7. SSWAB 38 15 - 57
but I don't need all the values, just the String and the integers.
I would use nextInt
for the Integers, but how can I deal with 1. and -?
Also there is the string, what is a useful nextString
? Is next
enough?
I have tried something like this, just using tokens, but nothing happens
scanner.next(); //7.
String s = (scanner.next()); //SAVES sswab
Integer n1 = scanner.nextInt(); //38
Integer n2 = scanner.nextInt(); //15
Integer n3 = scanner.nextInt(); //- is skipped, as next int is 57