Java Array to String arrayToStrings(String[] s, String delimiter)

Here you can find the source of arrayToStrings(String[] s, String delimiter)

Description

array To Strings

License

LGPL

Declaration

public static String arrayToStrings(String[] s, String delimiter) 

Method Source Code

//package com.java2s;
/**// ww w .j a  v  a2 s .  com
 *
 * Methods Descrip:Converts a line of text into an array of lower case words
 * using a BreakIterator.wordInstance().
 * <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text
 *            a String of text to convert into an array of words
 * @return text broken up into an array of words.
 *
 */

public class Main {

    public static String arrayToStrings(String[] s, String delimiter) {
        String res = "";

        for (int i = 0; i < s.length; i++) {
            if (!"".equals(s[i])) {
                res = res + s[i];

                if (i < (s.length - 1)) {
                    res = res + delimiter;
                }
            }
        }

        return res;
    }
}

Related

  1. arrayToString(T[] items, String delimiter)
  2. arrayToString2D(String title, String innerTitle, double[][] vect)
  3. arrayToStringArray(boolean[] values)
  4. arrayToStringDelimited(final String[] array, final String delimiter)
  5. arrayToStringNullable(String[] a)
  6. arrayToStringWithDifferenceOrientedFormat(double[] values, int minDigits)
  7. arrayToStringWithPrefix(T[] array, String splitter, String prefix)
  8. asString(final String[] array)
  9. asString(int[] objects, String separator)