Tuesday 31 December 2019

Java equivalent of Python "join" method for array?

How can I do this Python trick in Java?



>>> l = [1,2,3,4,5]
>>> print ' '.join(l)
1 2 3 4 5


This doesn't apply to Strings only. I am using generics and need to print any kind of value in the Array.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...