List of utility methods to do Array to String
String | toString(T[] array) to String if (array == null) return "null"; StringBuffer buf = new StringBuffer(); buf.append("["); boolean first = true; for (T t : array) { if (first) first = false; ... |
String | toString(T[] array, String prefix, String sep, String suffix) Provides a string representation of the elements in the given array. if (array == null || array.length == 0) return prefix + suffix; String result = prefix + array[0]; for (int i = 1; i < array.length; i++) { result += sep + array[i]; return result + suffix; |
String[] | toStringArray(Collection to String Array String[] array = strings.toArray(new String[] {}); if (sort) { Arrays.sort(array); return array; |
String[] | toStringArray(Dictionary props, String key, String[] defaultArray) to String Array if (props == null || key == null) { return defaultArray; final Object propValue = props.get(key); if (propValue == null) { return defaultArray; } else if (propValue instanceof String) { return new String[] { (String) propValue }; ... |
String[] | toStringArray(final E[] array) to String Array String[] stringList = null; if (array != null) { stringList = new String[array.length]; for (int i = 0; i < array.length; i++) { if (array[i] != null) { stringList[i] = array[i].toString(); } else { stringList[i] = null; ... |
String[] | toStringArray(int[] nums) to String Array if (nums == null) { return null; String[] fields = new String[nums.length]; int index = 0; for (Integer num : nums) { fields[index] = Integer.toString(num); index++; ... |
String[] | toStringArray(Object value) Convert an Object array to a String array by invoking toString on each element if (value instanceof String[]) { return (String[]) value; } else { Object[] valueArray = (Object[]) value; return Arrays.stream(valueArray).map(o -> o.toString()).toArray(size -> new String[size]); |
StringBuilder | toStringKeyValuePairs(Object[] keys, Object[] values, int size, StringBuilder dstOptional) Convert a pair of arrays to key-value strings in the format [key0=value0, key1=value1, ...] StringBuilder sb = dstOptional != null ? dstOptional : new StringBuilder(size > 50 ? 512 : size * 8); sb.append('['); if (size > 0) { int sizeTemp = size - 1; for (int i = 0; i < sizeTemp; i++) { sb.append(keys[i]); sb.append('='); sb.append(values[i]); ... |
String[] | toStrings(byte[] bytes) to Strings int len = toInt(bytes, 0); String[] strings = new String[len]; int offset = SIZEOF_INT; for (int i = 0; i < len; i++) { int n = toInt(bytes, offset); offset += SIZEOF_INT; strings[i] = new String(Arrays.copyOfRange(bytes, offset, n)); offset += n; ... |