List of utility methods to do CSV String Create
String | csv(String separator, String... elements) csv if (elements.length == 0) return null; StringBuilder sb = new StringBuilder(elements[0]); for (int i = 1; i < elements.length; i++) { sb.append(separator).append(elements[i]); return sb.toString(); |
String | getCSV(Collection coll) get CSV StringBuffer sb = new StringBuffer(); Iterator iterator = coll.iterator(); while (iterator.hasNext()) { sb.append(iterator.next().toString()); if (iterator.hasNext()) sb.append(","); return sb.toString(); ... |
String | getCSV(Collection> values) get CSV string from the collections. return getCSV(values, CSV_SEPARATOR, true);
|
String | getCsv(Collection get Csv String result = ""; if (collection.size() != 0) { result = getLocalCsv(collection); return result; |
String | getCSVPhrase(Collection> objects) Creates CSV phrase from objects return getCSVPhrase(objects, COMMA_CHAR);
|
String | toCSV(int[] a) to CSV String ret = ""; for (int i = 0; i < a.length; i++) { if (i != 0) { ret += ',' + a[i]; } else { ret += a[i]; return ret; |
String | toCsv(Object[] arr, String format) to Csv String ans = ""; if (arr.length > 0) { ans += String.format(format, arr[0]); String format2 = "," + format; for (int i = 1; i < arr.length; i++) { ans += String.format(format2, arr[i]); ans += "\n"; return ans; |
String | toCsv(String value) Formats a string for CSV escaping it as a double quoted CSV string if necessary if (value.contains(",")) { return "\"" + escapeQuotesForCsv(value) + "\""; } else { return value; |
String | toCSV3_2(double[][][] array, int index1, int index3) to CS_ int len2 = array[index1].length; if (len2 == 0) { return ""; StringBuffer s = new StringBuffer(); s.append(Double.toString(array[index1][0][index3])); for (int i = 1; i < len2; i++) { s.append(";").append(Double.toString(array[index1][i][index3])); ... |
String | toCSVBuffer(byte barr[]) to CSV Buffer StringBuffer sb = new StringBuffer(barr.length + 1); sb.append('#'); for (int idx = 0; idx < barr.length; idx++) { sb.append(Integer.toHexString((int) barr[idx])); return sb.toString(); |