How to transform a java String into a Java Array Object?

1

On a .jsp page, I have the following code:

String[] arrayRegioes = request.getParameterValues("numRegiaoUsuario");//objeto

When I print the arrayRegioes , the value shown is:

  

[Ljava.lang.String; @ 5a879b45

Now, I need to transform a string that was made in the hand:

[55826586566, 54555555454, 994139792]

On a array object, such as the format of the above one.

    
asked by anonymous 24.03.2016 / 14:22

1 answer

2

You could try something like that. PS: I did not test it, it's just something I remember from college time.

String[] array = values.split(",");

If there is a string with null values, you should use a second parameter, see example.

String[] array = values.split("\|", -1);
    
24.03.2016 / 14:27