List of utility methods to do Array to String
String | arrayToString(String[] array) Append an array of Strings to a String separated by a path separator. StringBuffer sB = new StringBuffer(); if (array.length > 0 ) { for (String i : array) { sB.append(i); sB.append(System.getProperty("path.separator")); return sB.toString(); ... |
String | arrayToString(String[] array) This takes a String[] and returns a String that can be converted back into an identical String[] using the stringToArray method. StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; i++) { sb.append(stuffString(array[i])); if (i < array.length - 1) sb.append("\"\\\""); return sb.toString(); |
String | arrayToString(String[] array) array To String String result = "{ "; for (String data : array) { result += data + ", "; result += " }"; return result; |
String | arrayToString(String[] array, int start, String delimiter) array To String String ret = ""; for (int i = start; i < array.length; i++) { if (i < array.length - 1) { ret += array[i] + delimiter; } else { ret += array[i]; return ret; |
String | arrayToString(String[] array, String delim, boolean quotes) array To String StringBuilder result; String quot = quotes ? "'" : ""; if (array.length == 0) return ""; result = new StringBuilder(); for (String elem : array) { result.append(quot + elem + quot + delim); result.deleteCharAt(result.length() - 1); return result.toString(); |
String | arrayToString(String[] array, String separator) array To String return arrayToString((Object[]) array, separator);
|
String | arrayToString(String[] array, String separator) Converts string array to single string separating fields with specified separator. StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i != 0) { builder.append(separator); builder.append(array[i]); return builder.toString(); ... |
String | arrayToString(String[] array, String separators) Takes an array of tokens and converts into separator-separated string. StringBuffer sb = new StringBuffer(""); String empty = ""; if (array == null) return empty; if (separators == null) separators = ","; for (int ix = 0; ix < array.length; ix++) { if (array[ix] != null && !array[ix].equals("")) { ... |
String | arrayToString(String[] arrayString, String splitStr) array To String StringBuilder sb = new StringBuilder(); if (arrayString == null || arrayString.length == 0) { return null; for (int i = 0; i < arrayString.length; i++) { if (arrayString[i] != null && arrayString[i].length() > 0) { if (sb.length() > 0) { sb.append(splitStr); ... |
String | arrayToString(String[] input) Helper method used to convert an Array of Strings into one multiline String. String output = ""; for (int i = 0; i < input.length; i++) { output += input[i]; output += System.lineSeparator(); return output; |