0
(my return)
I would like to convert a string into an array of characters, a character in each index.
I would like 'hi' to be converted to var[0] = 'o', var1 = 'i';
I am making an array calculator and need to read the matrix data of a txt file, the file:
2 2
34 78
89-12
@
2 2
67 76
123 5
I’m reading the file with (excerpt from the code):
BufferedReader in = new BufferedReader(new
FileReader(CaminhoArquivo));
I need to pass each of these characters(numbers) for each example: [2] [2] [34] [78] [89] [@]
package calculadoramatrizes;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Conteudo {
public List<String> Matriz(){
String CaminhoArquivo=("C:\\Users\\jessica borges"
+ "\\Downloads\\CalculadoraMatrizes-20190315T112959Z-001"
+ "\\CalculadoraMatrizes-20190315T112959Z-001"
+"\\CalculadoraMatrizes\\src\\ArquivosMatriz\\matrix.txt");
List<String> conteudo = new ArrayList<String>();
try {
BufferedReader in = new BufferedReader(new FileReader(CaminhoArquivo));
String linha;
while ((linha = in.readLine()) != null) {
conteudo.add(linha);
}
in.close();
} catch (IOException ioe) {
System.out.println(ioe);
}
System.out.println(conteudo);
return conteudo;
}
public void CriaMatriz(){
}
}
=================== main ====================
package calculadoramatrizes;
public class Matrix {
public static void main(String[] args){
chamarMatriz();
}
public static void chamarMatriz(){
Conteudo ct = new Conteudo();
ct.Matriz();
}
}
Jessica, take a look at this tip, on to mark questions with ' solved' "Solved" in question title does not seem like forum thing?
– Luiz Augusto