Convert Array of Strings into a String in Java
I Want the Java Code for Converting an Array of Strings into an String. 3 14 Answers Java 8+ Use String. Join(): String Str = String. Join(",", Arr); Note That...
I want the Java code for converting an array of strings into an string.
14 Answers
Java 8+
Use String.join():
String str = String.join(",", arr);
Note that arr can also be any Iterable (such as a list), not just an array.
If you have a Stream, you can use the joining collector:
Stream.of("a", "b", "c")
.collect(Collectors.joining(","))