Java String Array Combine combineString(String[] strArr, String glue)

Here you can find the source of combineString(String[] strArr, String glue)

Description

Combine several substring into one arge String

License

Creative Commons License

Return

combined String

Declaration

public static String combineString(String[] strArr, String glue) 

Method Source Code

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

public class Main {
    /**/*from   w ww.j  a v  a 2  s.co  m*/
     * Combine several substring into one arge String
     * 
     * @return   combined String
     */
    public static String combineString(String[] strArr, String glue) {
        String retval = "";

        for (int i = 0; i < strArr.length; i++) {
            retval += strArr[i];
            if (i < (strArr.length - 1)) {
                retval += glue;
            }
        }

        return retval;
    }
}

Related

  1. combineArrays(String[] array1, String[] array2)
  2. combineSplit(final int startIndex, final String[] string, final String seperator)
  3. combineSplit(int startIndex, String[] string, String separator)
  4. combineSplit(int startIndex, String[] string, String separator)
  5. combineSplit(int startIndex, String[] string, String separator)
  6. combineStringArray(String[] array, String delim)
  7. combineStrings(Object... strings)
  8. combineStrings(Object[] list)
  9. combineStrings(String[] strings)