Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter.
public static String join(CharSequence delimiter, CharSequence... elements) public static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements)
public class StringJoin { public static void main(String args[]) { String str = String.join("-", "a", "b", "c"); System.out.println(str); List<String> strs = Arrays.asList("d", "e", "f"); System.out.println( String.join("-", strs) ); } }
a-b-c d-e-f
#array #explode #implode #join #split #stringtokenizer #tokenizer