+ 1
Can you help me how to remove the space in my array
This is the output of my code: [2, 5]-[4]-[3, 1] And the expected output ; [2,5]-[4]-[3,1] Just need help to remove the space https://code.sololearn.com/cN4FLANp8uo3/?ref=app
3 Answers
+ 4
Ecyojer
What about to use replace method like this:
(startArray).replace(" ", "")
or store result in a variable name result and do like this:
System.out.println (result.replace(" ", ""));
+ 2
Thank you for your help A͢J - SÍoÍlÍoÍHÍeÍlÍpÍeÍrÍ
+ 1
Isn't that a part of output formatting / styling used by Arrays.toString(), including the use of square brackets?