How to convert java string array to string with delimiter
Using String.join method (from java 8)
1 2 |
String[] array = new String[] { "a", "b", "c" }; String joined2 = String.join(",", array); |
Using simple for-loop expression
1 2 3 4 5 6 |
StringBuilder sb = new StringBuilder(); for (String n : name) { if (sb.length() > 0) sb.append(','); sb.append("'").append(n).append("'"); } return sb.toString(); |
Read More