Java ArrayList Join joinCommandLine(ArrayList lsCmdl)

Here you can find the source of joinCommandLine(ArrayList lsCmdl)

Description

Joins a command line to a string.

License

LGPL

Parameter

Parameter Description
lsCmdl the list of argument strings

Return

the command line string

Declaration

public static String joinCommandLine(ArrayList<String> lsCmdl) 

Method Source Code

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

import java.util.ArrayList;

public class Main {
    /**//w w  w. j a  v a 2s .c  o  m
     * Joins a command line to a string.
     * @param lsCmdl the list of argument strings 
     * @return the command line string
     */
    public static String joinCommandLine(ArrayList<String> lsCmdl) {
        String sCmdl = "";
        if (lsCmdl != null)
            for (int i = 0; i < lsCmdl.size(); i++)
                if (lsCmdl.get(i) != null && lsCmdl.get(i).length() > 0) {
                    if (i > 0)
                        sCmdl += " ";
                    sCmdl += lsCmdl.get(i);
                }
        return sCmdl;
    }
}

Related

  1. join(final ArrayList arry, final String with)
  2. join(final ArrayList parts, final char separator)
  3. join(String glue, ArrayList a)
  4. joinArrayList(List coll, String delimiter)
  5. joinArrayList(String joiner, ArrayList array)
  6. joinList(ArrayList list, String joint)