Java CSV from listToCsvTags(List tagsList)

Here you can find the source of listToCsvTags(List tagsList)

Description

Converts a List of tags to a comma separated list

License

Apache License

Parameter

Parameter Description
tags a parameter

Return

String containing a comma separated list of tags

Declaration


public static String listToCsvTags(List<String> tagsList) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

import java.util.List;

public class Main {
    /**/* w w  w. j  a v  a 2 s.  c om*/
     * Converts a List of tags to a comma separated list
     * 
     * @param tags
     * @return String containing a comma separated list of tags
     */

    public static String listToCsvTags(List<String> tagsList) {
        String tags = "";
        if (tagsList.size() > 0) {
            for (int i = 0; i < tagsList.size(); i++) {
                tags += tagsList.get(i);
                if (i != tagsList.size() - 1) {
                    tags += ",";
                }
            }
        }

        return tags;
    }
}

Related

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