Hi, I have the following problem, I am creating a class so that the file management is more user-friendly for an app that I am creating.
The issue is that when trying to create a custom method to read and tabulate the data of a txt in a String[]
I need to know some function that tells me how many are stored before null
.
Previously in an earlier version of the class I am creating I used this form:
String[][] leido = new String [2][9999];
String lineaActual = "";
try
{
FileReader f = new FileReader(txt);
BufferedReader buffer = new BufferedReader(f);
for (int i = 0; lineaActual != null ; i++)
{
try {lineaActual = buffer.readLine();}
catch (IOException e) {System.out.println(e.getMessage());}
leido[0][i] = lineaActual;
leido[1][0] = Integer.toString(i); //Aqui almacenaba el limite de los String
}
}
catch (FileNotFoundException e) {System.out.println(e.getMessage());}
return leido;
Excuse my terrible newbie code little by little I try to clean up with the new version I'm doing but I need to know some function that helps me with the account so I do not have to use a String[][]
but a String[]
.