Java Array to String array2String(String[] array)

Here you can find the source of array2String(String[] array)

Description

array String

License

Apache License

Declaration

public static String array2String(String[] array) 

Method Source Code

//package com.java2s;
/*/*  w  w  w. j  av  a2 s  .  com*/
 * Copyright (c) 2014. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

public class Main {
    private final static String SPLIT_SYMBOL = "|";

    public static String array2String(String[] array) {
        if (array == null || array.length <= 0)
            return null;
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < array.length - 1; i++) {
            builder.append(array[i]);
            builder.append(SPLIT_SYMBOL);
        }
        builder.append(array[array.length - 1]);
        return builder.toString();
    }
}

Related

  1. array2String(long[] array)
  2. array2String(Object[] a, int size)
  3. array2string(Object[] array)
  4. array2String(Object[] objs)
  5. array2String(String[] array)
  6. array2String(String[] category)
  7. array2String(String[] p, String spliter)
  8. Array2String(String[] values)
  9. array2String(T... array)