devxlogo

April 16, 2019

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);