List of utility methods to do CSV from
List | getCSVList(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(); ... |
String | getCSVString(List 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; |
String | getCsvStringsFromList(final List 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(); |
List | getepcList(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] + ".%"; ... |
ArrayList | getFixedArrayListSizeFromCSV(String csvString, int returnArrayListSize) get Fixed Array List Size From CSV ArrayList<String> returnArray = getArrayListFromCSV(csvString); while (returnArray.size() < returnArrayListSize) returnArray.add(""); return returnArray; |
List | getListFromCSV(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; ... |
List | getListFromCSV(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]); ... |
List | getListFromCSVString(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) ... |
String | getPrintableCSVs(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(", "); ... |
Integer | getRightFirstRow(List 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); ... |