List of utility methods to do Array to String
String | convertArrayToString(String[] array, char seperator) convert Array To String if (array == null) return null; StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { sb.append(array[i]); if (i != array.length - 1) { sb.append(seperator); return sb.toString(); |
String | convertArrayToString(String[] array, String separator) * This method convert array to a string which is seperated by a seprator passed in argument. StringBuilder builder = new StringBuilder(); for (String string : array) { if (string != null) { builder.append(separator).append(string); return builder.substring(separator.length()); |
String | convertArrayToString(String[] array, String separator) Converts an Array of Strings into a formatted String StringBuilder sb = new StringBuilder(); separator = (separator == null || separator.isEmpty()) ? " " : separator; for (String str : array) { sb.append(str).append(separator); return sb.toString().trim(); |
String | convertArrayToString(String[] fields, String delimiter) convert Array To String StringBuilder csvStringBuilder = new StringBuilder(); for (int i = 0; i < fields.length; i++) { if (i > 0) { csvStringBuilder.append(delimiter); csvStringBuilder.append(fields[i]); return csvStringBuilder.toString(); ... |
String | convertArrayToString(String[] idArray) convert Array To String StringBuffer sb = new StringBuffer(); for (Object obj : idArray) { sb.append(obj); sb.append(","); sb.delete(sb.length() - 1, sb.length()); return sb.toString(); |
String | convertArrayToString(String[] strArray) convert Array To String StringBuffer strList = new StringBuffer(); if (strArray != null) { for (int i = 0; i < strArray.length; i++) { if (i != 0) { strList.append(","); strList.append(strArray[i]); return strList.toString(); |
String | convertByteToString(byte[] objectGuid) convert Byte To String StringBuilder builder = new StringBuilder(); for (byte element : objectGuid) { int item = element & 0xFF; if (item <= 0xF) { builder.append("0"); builder.append(Integer.toHexString(item)); return builder.toString(); |
String | convertToString(String[] args) convert To String List<String> stringList = new ArrayList<>(); for (int i = 0; i < args.length; i++) stringList.add(args[i]); return convertToString(stringList); |
String | convertToString(String[] values, String separator) Convert to string. StringBuilder converted = new StringBuilder(); if (values != null) { for (String value : values) { if (converted.length() > 0) { converted.append(separator); converted.append(value); return converted.toString(); |
String | deepToString(Object[] a) Returns a string representation of the "deep contents" of the specified array. if (a == null) return "null"; int bufLen = 20 * a.length; if (a.length != 0 && bufLen <= 0) bufLen = Integer.MAX_VALUE; StringBuilder buf = new StringBuilder(bufLen); deepToString(a, buf, new HashSet<Object[]>()); return buf.toString(); ... |