Java String from List stringListToString(List strList, String delim)

Here you can find the source of stringListToString(List strList, String delim)

Description

stringListToString -

License

Open Source License

Parameter

Parameter Description
strList - String List
delim - delimiter betwen each string

Return

String

Declaration

public static String stringListToString(List<String> strList, String delim) 

Method Source Code


//package com.java2s;

import java.util.List;

public class Main {
    /***************************************************************************
     * stringListToString -/*from w  w w .j a v  a 2 s  .  com*/
     * @param strList - String List
     * @param delim - delimiter betwen each string
     * @return String
     **************************************************************************/
    public static String stringListToString(List<String> strList, String delim) {

        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < strList.size(); i++) {
            String s = (String) strList.get(i);
            if (i != 0) {
                sb.append(delim);
            }
            sb.append(s);
        }
        return sb.toString();
    }
}

Related

  1. stringListToString(List list)
  2. stringListToString(List list)
  3. stringListToString(List list, String delim)
  4. stringListToString(List ls)
  5. stringListToString(List stringList, String delim)
  6. stringsAsBytes(List strs)
  7. stringToMatriz(List linhas)