Android List to String Convert getCommaDelimitedString(List input)

Here you can find the source of getCommaDelimitedString(List input)

Description

Returns a comma delimited String from input list of strings.

License

Apache License

Parameter

Parameter Description
input List<String>

Return

String

Declaration

public static String getCommaDelimitedString(List<String> input) 

Method Source Code

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

import java.util.List;

public class Main {
    /**/*from   ww w  . java 2s  .  co m*/
     * Returns a comma delimited String from input list of strings.
     *
     * @param input List<String>
     * @return String
     */
    public static String getCommaDelimitedString(List<String> input) {
        String output = "";

        if (input != null && input.size() > 0) {
            for (String tag : input) {
                output += tag + ",";
            }

            output = output.substring(0, output.length() - 1);
            output = output.replaceAll(" ", "");
        }

        return output;
    }
}

Related

  1. listLongToString(List inputList)
  2. listStrToString(List inputList)
  3. listToString(List list)
  4. convertStringArrayToString( List stringList, String seperator)
  5. listToString(List list, String delimiter)