Java Object Array to String objectArrayToString(String separator, Object... objects)

Here you can find the source of objectArrayToString(String separator, Object... objects)

Description

Returns a string which is a concatenation of the #toString() of the objects passed to the method, separated by #separator

License

Open Source License

Declaration

public static String objectArrayToString(String separator, Object... objects) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  w  w . ja va2 s.c  o m
     * Returns a string which is a concatenation of the {@link #toString()} of the
     * objects passed to the method, separated  by {@link #separator}   
     */
    public static String objectArrayToString(String separator, Object... objects) {
        StringBuffer buffer = new StringBuffer();
        for (Object obj : objects) {
            buffer.append(obj.toString()).append(separator);
        }
        String res = buffer.toString();
        if (res.lastIndexOf(separator) == -1) {
            return res;
        }
        return res.substring(0, res.lastIndexOf(separator));
    }
}

Related

  1. objectArrayToString(Object[] arr)
  2. objectArrayToString(Object[] arr, String name)
  3. objectArrayToString(Object[] objArray, String separator)
  4. objectArrayToString(Object[] objectArray)
  5. objectArrayToString(Object[] objects)
  6. objectArrayToStringArray(final Object[] objectArray)
  7. objectArrayToStringArray(Object data[])
  8. objectArrayToStringArray(Object[] objectArray)
  9. objectArrayToStringArray(Object[] objs)