Here you can find the source of convertStringListToCSV(List
public static String convertStringListToCSV(List<String> source)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String convertStringListToCSV(List<String> source) { String finalString = ""; if (source != null && !source.isEmpty()) { for (String s : source) { if (s != null) { finalString = finalString.isEmpty() ? finalString + getValidCsvValue(s) : finalString + "," + getValidCsvValue(s); }/*from w w w .j av a 2 s.c o m*/ } } return finalString; } public static String getValidCsvValue(String value) { if (value.contains(",")) { value = "\"" + value + "\""; } return value; } }