I need your help, I have a chain like the following
String texto= "[{abc-123,mazda,caba,2016,s,26000};
{xyz-215,nissan,almera,2014,a,18000};{efg-901,mazda,2,2012,m,17000}]";
I need this chain to separate and add all to a ArrayList
of an Automobile object that has the following fields of placa
, marca
, modelo
, anio
, transmisión
and precio
respectively.
I have used the substring
method within a for
to separate it, then I have replaced the unwanted characters and saved it in another string which results in the following.
abc-123,mazda,caba,2016,s,26000
xyz-215,nissan,almera,2014,a,18000
efg-901,mazda,2,2012,m,17000
Even so I can not add this string
, where I save it, to my list of car objects.
List<Automovil> lista = new ArrayList<Automovil>();
PSDT: I am new to the forum, I hope you have let me understand, I appreciate your time dedicated to helping me.