To join a array to string in Java you can use the following snippet.
Sample Java
public static String JoinArraylist(List<String> input, String delimiter, Boolean appendToEnd){ Iterator<String> iteratorString = input.iterator(); StringBuilder stringBuilder = new StringBuilder(); for (;;) { stringBuilder.append(iteratorString.next()); if (!iteratorString.hasNext()){ break; } stringBuilder.append(delimiter); } if(appendToEnd){ stringBuilder.append(delimiter); } return stringBuilder.toString(); }
RT @CodeSnippetsNET: How to join a array to string in #Java http://t.co/KGTVJVMHKr #programming #code #coding #dev