Java String Array Merge merge(String[] pieces, String sep)

Here you can find the source of merge(String[] pieces, String sep)

Description

merge

License

Open Source License

Declaration

static public String merge(String[] pieces, String sep) 

Method Source Code

//package com.java2s;
/* Copyright 2012, UCAR/Unidata.
 See the LICENSE file for more information. */

public class Main {
    static public String merge(String[] pieces, String sep) {
        if (pieces == null)
            return "";
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < pieces.length; i++) {
            if (i > 0)
                buf.append(sep);/*from w  w w.  j  a  v a2s .c o m*/
            buf.append(pieces[i]);
        }
        return buf.toString();
    }
}

Related

  1. merge(String[] arr)
  2. merge(String[] mainSelector, String[] base)
  3. merge(String[] src, String delimiter)
  4. merge(String[] str, String sep)
  5. merge(T[] arr0, String delimiter)
  6. mergeInts(int[] values, String delimiter)