Mega Code Archive

 
Categories / Java / Data Type
 

Converts a String array to an String, joined by the Seperator

public class Util{     /**      * Converts a String array to an String, joined by the Seperator      *      * @param items     The String Array to Join      * @param seperator The Seperator used to join the String      * @return The Joined String      */     public static String arrayToString(String[] items, String seperator) {         if ((items == null) || (items.length == 0)) {             return "";         } else {             StringBuffer buffer = new StringBuffer(items[0]);             for (int i = 1; i < items.length; i++) {                 buffer.append(seperator);                 buffer.append(items[i]);             }             return buffer.toString();         }     } }