Android Array to String Convert stringArrayToString(String[] array)

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

Description

string Array To String

Declaration

public static String stringArrayToString(String[] array) 

Method Source Code

//package com.java2s;

public class Main {
    public static String stringArrayToString(String[] array) {
        return arrayToString(array);
    }/*from  ww w  .  j  ava  2  s.  c  o m*/

    public static String arrayToString(String[] array) {
        if (array == null || array.length == 0) {
            return "";
        }

        StringBuilder builder = new StringBuilder();
        for (String s : array) {
            builder.append(s).append("; ");
        }
        builder.delete(builder.length() - 2, builder.length());

        return builder.toString();
    }

    public static String arrayToString(Object[] array) {
        if (array == null || array.length == 0)
            return "[]";

        StringBuffer strings = new StringBuffer();
        strings.append("[");
        for (Object x : array) {
            strings.append(x.toString()).append("; ");
        }
        strings.delete(strings.length() - 2, strings.length());
        strings.append("]");
        return strings.toString();
    }
}

Related

  1. toString(final byte[] bytes)
  2. toString(final byte[] bytes, String charset)
  3. toStringArrayToString(String[] array)
  4. ArraysToString(String[] arrays)
  5. ArrayToString(Object[] ary)
  6. intArraysToString(int[] arrays)
  7. stringArrayToString(String[] array)
  8. convertToString(long[] ids)