Java CSV from toCsv(List strs)

Here you can find the source of toCsv(List strs)

Description

to Csv

License

Open Source License

Declaration

public static String toCsv(List<String> strs) 

Method Source Code


//package com.java2s;
/*/*from w  w  w .  java2 s . co  m*/
Copyright 2011 Northbranchlogic, Inc.
    
This file is part of Parallel Processing with EC2 (ppe).
    
ppe is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
ppe is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with ppe.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.*;

public class Main {
    public static String toCsv(List<String> strs) {
        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());
    }
}

Related

  1. parseCsvList(String csvList)
  2. sanitizeListForCsv(List strList)
  3. toCsv(final List list)
  4. toCsv(List list)
  5. toCsv(List list)
  6. toCSV(List list)
  7. toCSV(Set list)
  8. toCSVLine(String[] strArray)
  9. toCSVString(List list, boolean quote)