4
I am receiving in my java code a variable with the following value
String arquivo = "CNPJ;INSCRICAOESTADUAL;COD_IBGE;DT_OPE;VLR_CARTAO_CRED;VLR_CARTAO_DEB
35083840049;0;4312476;13/01/2018;0.00;66.00
35083840049;0;4312476;18/01/2018;33.00;26.00
35083840049;0;4312476;19/01/2018;0.00;38.40
35083840049;0;4312476;20/01/2018;0.00;55.00
35083840049;0;4312476;21/01/2018;59.80;0.00
35083840049;0;4312476;31/01/2018;0.00;122.00
91589507000854;3770005769;4312476;02/01/2018;2492.59;2742.34
91589507000854;3770005769;4312476;03/01/2018;1333.95;1686.86"
however, I want to play these values in an array where, respectively, CNPJ
is 35083840049
INSCRICAOESTADUAL
is 0
and so successively with the other values.
When debugging the code I saw that I am having the following result:
i.e., it is mounting an array with all the result.
I’m using this method:
String arquivo = arquivoDecodificado;
String[] items = arquivo.split(";");
List<String> itemList = new ArrayList<String>();
for (String item : items) {
itemList.add(item);
}
System.out.println(itemList);
How can I make it the way I need it ??
It would not be easier to read line by line a file . csv and make an object Arraylist with the fields?
– Gustavo Fragoso
@Gustavofragoso has some example to show ?
– Eduardo Krakhecke