I need to convert a string
variable to a array
, I tried to do the following, I have the variable string
contentLote , where its value is:
[["4","SCAB171301BF5","Vazio","Lexmark International","50F0Z00",null,null,"2017-10-27 08:54:56",false,"ROMUALDO SANTOS"]]
I tried converting it to array as follows:
def array = conteudoLote.toCharArray()
for (List listaTeste : array){
logger.info("NÚMERO DE SÉRIE: "+listaTeste.get(1).toString()) //Aqui serve somente para visualizar o conteúdo do index 1 do meu array
}
However, the following error occurred:
Cannot cast object '[' with class 'java.lang.Character' to class 'java.util.List'
How can I convert this string
to array
then? My need is to get that part of the string SCAB171301BF5
which would be index 1 in the case.