List of utility methods to do CSV from
List | parseCsvList(String csvList) Parse a comma separated string into a sequence of strings. List<String> list = new ArrayList<String>(); if (csvList == null || csvList.isEmpty()) return list; String[] split = csvList.split("\\s*,\\s*"); for (String v : split) { if (!v.equals("")) list.add(v); return list; |
List | sanitizeListForCsv(List Sanitizes the list of strings for comma-separated values (CSV) file output. We follow the definition described by RFC 4180: http://tools.ietf.org/html/rfc4180 List<String> sanitizedStrList = new ArrayList<String>(); Iterator<String> itr = strList.iterator(); while (itr.hasNext()) { sanitizedStrList.add(sanitizeForCsv(itr.next())); return sanitizedStrList; |
String | toCsv(final List Convert List of strins to csv return toString(list, ';'); |
String | toCsv(List to Csv String csv = ""; Integer size = list.size(); for (int i = 0; i < size; i++) { csv += list.get(i).toString() + ","; return csv.substring(0, csv.length() - 1); |
String | toCsv(List Convert the list of strings to a comma separated string String res = ""; Iterator<String> it = list.iterator(); while (it.hasNext()) { res += it.next(); if (it.hasNext()) res += ", "; return res; ... |
String | toCsv(List to Csv StringBuilder s = new StringBuilder(); for (int i = 0; i < strs.size() - 1; i++) { s.append(strs + ", "); s.append(strs.get(strs.size() - 1)); return (s.toString()); |
String | toCSV(List to CSV StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { if (i != 0) { sb.append(COMMA); sb.append(list.get(i)); return sb.toString(); ... |
String | toCSV(Set to CSV return _toCSV(list);
|
String | toCSVLine(String[] strArray) to CSV Line if (strArray == null) { return ""; StringBuffer cvsLine = new StringBuffer(); for (int idx = 0; idx < strArray.length; idx++) { String item = addQuote(strArray[idx]); cvsLine.append(item); if (strArray.length - 1 != idx) { ... |
String | toCSVString(List to CSV String List<String> newList = new ArrayList<String>(); for (String value : list) { if (quote == true) { newList.add(quote(value)); } else { newList.add(value); if (newList != null && newList.size() > 0) { String values = newList.toString(); values = values.substring(1, values.length() - 1); return values; return null; |