I need to read a txt
file and check if the text file has "First Name". If it contains, it should split the line and display the line in the console.
public String[] getFullname() {
try {
BufferedReader br = new BufferedReader(new FileReader("src\\main\\resources\\CV.docx"));
String line = br.readLine();
while (line != null) {
if (line.startsWith("Full Name")) {
String[] fname = line.split(":");
System.out.println(Arrays.toString(fname));
firstname = fname;
}
line = br.readLine();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return firstname;
}