Java CSV from parseCsvList(String csvList)

Here you can find the source of parseCsvList(String csvList)

Description

Parse a comma separated string into a sequence of strings.

License

Apache License

Declaration

public static List<String> parseCsvList(String csvList) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**//  w  ww. j  a  v  a  2  s  .c  o  m
     * Parse a comma separated string into a sequence of strings.
     * Whitespace surrounding the comma will be removed.
     */
    public static List<String> parseCsvList(String csvList) {
        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;
    }
}

Related

  1. listToCsv(List strs)
  2. ListtoCSV(List thelist, String sep)
  3. listToCSVString(List list)
  4. listToCsvTags(List tagsList)
  5. parseCSVList(String csv)
  6. sanitizeListForCsv(List strList)
  7. toCsv(final List list)
  8. toCsv(List list)
  9. toCsv(List list)