Java String Implode implode(String glue, String[] inputArray)

Here you can find the source of implode(String glue, String[] inputArray)

Description

implode

License

Open Source License

Declaration

public static String implode(String glue, String[] inputArray) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 The PDT Extension Group (https://github.com/pdt-eg)
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/

public class Main {
    public static String implode(String glue, String[] inputArray) {

        StringBuilder sb = new StringBuilder();
        sb.append(inputArray[0]);/* w ww .j a v a2s.  co m*/

        for (int i = 1; i < inputArray.length; i++) {
            sb.append(glue);
            sb.append(inputArray[i]);
        }

        return sb.toString();
    }
}

Related

  1. implode(Object[] elements, String delimiter)
  2. implode(Object[] source, String delimiter)
  3. implode(String delim, Object[] array)
  4. implode(String delimiter, String[] strings)
  5. implode(String glue, String... parts)
  6. implode(String glue, String[] pieces)
  7. implode(String glue, String[] pieces)
  8. implode(String glue, String[] strArray)
  9. implode(String glue, T[] array)