Java Array Implode implodeArray(String[] inputArray, String glueString)

Here you can find the source of implodeArray(String[] inputArray, String glueString)

Description

implode Array

License

Creative Commons License

Declaration

public static String implodeArray(String[] inputArray, String glueString) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    public static String implodeArray(String[] inputArray, String glueString) {
        /** Output variable */
        String output = "";

        if (inputArray.length > 0) {
            StringBuilder sb = new StringBuilder();
            sb.append(inputArray[0]);/*from w w w.  j a v a2s.co m*/

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

            output = sb.toString();
        }

        return output;
    }
}

Related

  1. implode(String[] data, String glue)
  2. implode(String[] inputArray, String glueString)
  3. implode(String[] values, String separator, String beforeEach, String afterEach)
  4. implodeArray(Object[] array)
  5. implodeArray(Object[] items, String prefix, String suffix, String delimiter, String lastItemSuffix)
  6. implodeArray(String[] inputArray, String glueString, int start)
  7. implodeString(String[] strArray, String strDelim)
  8. implodeStringArray(Object[] pieces, String delim)