List of utility methods to do Array to CSV
String | ArrayToCsv(Object[] line) Array To Csv StringBuilder csvLine = new StringBuilder(); for (Object obj : line) { csvLine.append(obj.toString()).append(","); csvLine.setCharAt(csvLine.length() - 1, '\n'); return csvLine.toString(); |
String | ArrayToCSV(String[] array) Array To CSV StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { String string = array[i]; if (i == 0) sb.append(string); else sb.append("," + string); return sb.toString(); |
String | arrayToCsvString(String[] array, char delimiter) Utility method to convert a String array to CSV/TSV row string. StringBuilder arrayString = new StringBuilder(); for (String arrayElement : array) { arrayString.append(arrayElement); arrayString.append(delimiter); return arrayString.toString(); |
String | toCSV(double[] as) to CSV StringBuilder b = new StringBuilder(); for (int i = 0; i < as.length - 1; i++) { b.append(as[i]); b.append(","); b.append(as[as.length - 1]); return b.toString(); |
String | toCSV(int[][] values) to CSV String vs[][] = new String[values.length][]; for (int i = 0; i < values.length; i++) { vs[i] = new String[values[i].length]; for (int j = 0; j < values[i].length; j++) { vs[i][j] = "" + values[i][j]; return toCSV(vs); ... |
String | toCSV(Object[] objs) to CSV return toCSV(objs, false);
|
String | toCSVString(String[] strArray) to CSV String if (strArray == null) return null; StringBuilder sb = new StringBuilder(); for (Iterator<String> itr = Arrays.asList(strArray).iterator(); itr.hasNext();) { String s = itr.next(); sb.append(s); if (itr.hasNext()) sb.append(","); ... |