Joining Strings with a Delimiter

Starting with Java 8, we can join several strings with a delimiter (e.g., comma) via the String.join() method:

String result = String.join(", ", "One", "Two", "Three");// One, Two, ThreeSystem.out.println(result);
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts