Java Array Implode implode(String delim, String[] args)

Here you can find the source of implode(String delim, String[] args)

Description

implode

License

LGPL

Declaration

private static String implode(String delim, String[] args) 

Method Source Code

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

import java.util.*;

public class Main {
    private static String implode(String delim, String[] args) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < args.length; i++) {
            if (i > 0) {
                sb.append(delim);//from  w ww.j  av a2 s . co m
            }
            sb.append(args[i]);
        }
        return sb.toString();
    }

    private static String implode(String delim, ArrayList<String> args) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < args.size(); i++) {
            if (i > 0) {
                sb.append(delim);
            }
            sb.append(args.get(i));
        }
        return sb.toString();
    }
}

Related

  1. implode(final String[] array, final String delim)
  2. implode(final String[] pStrArray)
  3. implode(Object[] array, String separator)
  4. implode(Object[] ary, String delim)
  5. implode(String delim, Object[] objects)
  6. implode(String[] array, String separator)
  7. implode(String[] data, String glue)
  8. implode(String[] inputArray, String glueString)
  9. implode(String[] values, String separator, String beforeEach, String afterEach)