0
I need to convert a variable string
in a array
, I tried to do as follows, I have the variable string
conteudoLote, where its value is:
[["4","SCAB171301BF5","Vazio","Lexmark International","50F0Z00",null,null,"2017-10-27 08:54:56",false,"ROMUALDO SANTOS"]]
I tried to convert the same 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
for array
then? My need is to get this part of the string SCAB171301BF5
which would be index 1 in the case.
You have already turned the String into an array of char. In your
for
you must exchangeList
forchar
.– Leonardo Lima
@Leonardolima, how can I access the contents of this mine
array
like this? Because I need to take this from my stringSCAB171301BF5
which would be the index 1 of my array– R.Santos