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

ListgetCSVList(String csvList)
get CSV List
if (csvList == null || csvList.length() == 0)
    return Collections.emptyList();
List<String> ret = new ArrayList<String>(Arrays.asList(csvList.split(",")));
Iterator<String> iter = ret.iterator();
while (iter.hasNext()) {
    final String next = iter.next();
    if (next == null || next.length() == 0) {
        iter.remove();
...
StringgetCSVString(List items)
get CSV String
String csv = "";
if (items.size() > 0) {
    for (String s : items)
        csv += s.trim() + ",";
    return csv.substring(0, csv.length() - 1);
} else
    return csv;
StringgetCsvStringsFromList(final List stringsToDelimit)
Convert a List of String objects to a CSV list of strings
final StringBuilder sbCSVStrings = newStringBuilder();
if (stringsToDelimit != null) {
    for (int count = 0; count < stringsToDelimit.size(); count++) {
        sbCSVStrings.append(stringsToDelimit.get(count));
        if (count + 1 < stringsToDelimit.size()) {
            sbCSVStrings.append(",");
return sbCSVStrings.toString();
ListgetepcList(String csv)
getepc List
String[] eqArr = csv.split(",");
List<String> subStringList = new ArrayList<String>();
for (int i = 0; i < eqArr.length; i++) {
    String eqString = eqArr[i].trim();
    String[] pat = eqString.split(":");
    if (pat[3].equals("idpat")) {
        String[] pat2 = pat[4].split("\\.");
        String conc = pat[0] + ":" + pat[1] + ":id" + ":" + pat[3] + ":" + pat2[0] + ".%";
...
ArrayListgetFixedArrayListSizeFromCSV(String csvString, int returnArrayListSize)
get Fixed Array List Size From CSV
ArrayList<String> returnArray = getArrayListFromCSV(csvString);
while (returnArray.size() < returnArrayListSize)
    returnArray.add("");
return returnArray;
ListgetListFromCSV(String myCsv)
Convert the command seperated values to a list
if (null == myCsv)
    return null;
List<String> output = new ArrayList();
String[] fields = myCsv.split(",");
for (int i = 0; i < fields.length; i++) {
    output.add(fields[i]);
return output;
...
ListgetListFromCSV(String myCsv)
get List From CSV
List<String> output = new ArrayList();
if (null == myCsv)
    return output;
String[] fields = myCsv.split(",");
if (null == fields)
    return output;
for (int i = 0; i < fields.length; i++) {
    output.add(fields[i]);
...
ListgetListFromCSVString(String csvString)
get List From CSV String
String[] returnArray = new String[0];
if (!isNullOrEmpty(csvString)) {
    String[] splitIt = csvString.split(",");
    returnArray = splitIt;
    if (splitIt.length > 0) {
        returnArray = new String[splitIt.length];
        int i = 0;
        for (String b : splitIt)
...
StringgetPrintableCSVs(List list)
get Printable CS Vs
if (list.size() < 1) {
    return "";
} else if (list.size() == 1) {
    return String.valueOf(list.get(0));
StringBuilder builder = new StringBuilder();
for (int i = 0; i < list.size() - 2; i++) {
    builder.append(list.get(i)).append(", ");
...
IntegergetRightFirstRow(List csvRows)
get Right First Row
Integer numbersOfColumns = null;
int parserLine = csvRows.size();
if (parserLine > 50) {
    parserLine = 50;
for (int i = 0; i < parserLine; i++) {
    if (csvRows.get(i) != null) {
        String[] nbRow = csvRows.get(i);
...