Java Utililty Methods CSV from

List of utility methods to do CSV from

Description

The list of methods to do CSV from are organized into topic(s).

Method

StringtoCsvString(List values)
to Csv String
if (values == null || values.isEmpty())
    return "";
StringBuilder builder = new StringBuilder();
for (String value : values)
    builder.append(value).append(',');
builder.deleteCharAt(builder.length() - 1);
return builder.toString();
StringtoCsvString(List values)
to Csv String
String csvString = toDelimitedString(values, ",", true);
return csvString;
StringtoCSVString(List values, boolean[] quoteColumn, String fieldSeparator, String quotationChar)
to CSV String
StringBuilder sb = new StringBuilder();
if (values.size() != quoteColumn.length) {
    throw new IllegalArgumentException("values and quoteColumn must have the same lengths!");
int valsize = values.size();
for (int i = 0; i < valsize; i++) {
    String s = values.get(i);
    if (quoteColumn[i]) {
...
ListtoObjectList(String csvString)
Splits a coma separated list of strings, into an array.
if (csvString == null || csvString.isEmpty())
    return new ArrayList<String>();
return Arrays.asList(csvString.split(","));