I need to load (int) data from file. New line separates different data so it’s important to know where the new line is. I can use
string=readln();
and then I have whole line in that string. Then I can
string.trim("//s+")
which chooses words(numbers) from string.
I can parse them to int:
int x = parseInt(string.trim("//s+").toString() );
Which should work (in theory) but it doesn’t! There is Java.lang.something, but no number!
How can I do it?
I like to use a set of two Scanners. One to read in the file line by line, assigning each new line to a temporary String, and another to read the line and gather the ints. Something like this: