List of utility methods to do String Array Join
String | join(String[] parts, String delimiter) Join a string array into a single string. StringBuilder builder = new StringBuilder(); for (String s : parts) { builder.append(s).append(delimiter); if (builder.length() > 0) { return builder.substring(0, builder.length() - delimiter.length()); return EMPTY; |
String | join(String delimiter, Object... chunks) Efficiently combines the string representations of the specified objects, delimiting each chunk with the specified delimiter. int nChunks = chunks.length; int delimLength = delimiter == null ? 0 : delimiter.length(); int estimate = delimLength * (nChunks - 1); for (Object chunk : chunks) { if (chunk != null) { estimate += chunk instanceof CharSequence ? ((CharSequence) chunk) .length() : 10; StringBuilder sb = new StringBuilder(estimate); for (int i = 0; i < nChunks; i++) { Object chunk = chunks[i]; if (chunk != null) { String string = chunk.toString(); if (string != null && string.length() > 0) { sb.append(string); if ((i + 1) < nChunks && delimiter != null) { sb.append(delimiter); return sb.toString(); |
String | join(String separator, Object... texts) join StringBuilder result = new StringBuilder(); boolean isFirst = true; for (Object text : texts) { if (isFirst) { result.append(separator); isFirst = false; result.append(text); ... |
String | join(String[] track) join StringBuilder buf = new StringBuilder(11 * track.length); for (String str : track) { if (0 != buf.length()) { buf.append(","); buf.append(str); return buf.toString(); ... |
String | join(String delimiter, String[] array) join StringBuilder stringBuilder = new StringBuilder(); int aLen = array != null ? array.length : -1; if (array != null && aLen > 1) { stringBuilder.append(array[0]).append(delimiter); for (int i = 1; i < aLen - 1; i++) { stringBuilder.append(array[i]).append(delimiter); return stringBuilder.append(array[aLen - 1]).toString(); ... |
String | join(String[] strArray, String separator) join StringBuilder sb = new StringBuilder(); if (strArray != null) { boolean isFirst = true; for (int i = 0; i < strArray.length; i++) { if (isFirst) { isFirst = false; } else { sb.append(separator); ... |
String | join(String[] array, String separator) join return join(array, separator, false);
|
String | arrayToStr(String[] array) Convert array of Strings to String using default delimiter (",") return arrayToStr(array, DEFAULT_DELIM);
|
String | arrayToStr(String[] array, String delim) Convert array of Strings to String if (array == null) { return null; if (array.length == 0) { return ""; StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { ... |
String | implode(String[] array) implode if (array != null && array.length > 0) { StringBuilder sb = new StringBuilder(); for (String string : array) { sb.append(string); return sb.toString(); return ""; ... |