I have a problem. I created a application which reads a txt file and splits sentence using the substring function. This is code:
public static void main(String[] args) throws IOException {
String linia = "";
Ob parser = new Ob();
try{
FileReader fr = new FileReader("C:/Dane.txt");
BufferedReader bfr = new BufferedReader(fr);
linia = bfr.readLine();
parser.spl(linia);
} catch( IOException ex ){
System.out.println("Error with: "+ex);
}
}
public class Ob {
String a,b;
public void spl(String linia)
{
a = linia.substring(14, 22);
b = linia.substring(25, 34);
System.out.println(a);
System.out.println(b);
}
}
That works properly, but I want to extend this application. I want to read every line of the text file and save the lines in a String array. I then want to pass every line from the array into my spl
function. How can I do that?