I have a file with the lines like this:
ACV01S
ACV02S
ACV03N
ACV03A
And so on (Without the blank lines)
In this part of my code
public static int LerFicheiroLeiParaMatriz(String[][] matrizVotos, String nome) throws FileNotFoundException {
Scanner finput = new Scanner(new File(nome));
File f = new File(nome);
int numeroDeputadosVotos = 0;
do {
String temp = finput.nextLine().trim();
boolean valido = true;
if (!temp.isEmpty()) {
matrizVotos[numeroDeputadosVotos][0] = temp.substring(0, 5);
matrizVotos[numeroDeputadosVotos][1] = temp.substring(5);
valido = ValidarCodigo(matrizVotos[numeroDeputadosVotos][0]);
if (valido && matrizVotos[numeroDeputadosVotos][1].length() == 1) {
numeroDeputadosVotos++;
}
}
} while (finput.hasNextLine());
return numeroDeputadosVotos;
}
The Scanner reads the first line without any problem. The problem is when using the sub string instead of staying like:
ACV01 S
it stays
ACV0 1S
The rest of the file displays normally. Any thoughts?