src/main/java/org/jboss/util/Strings.java
/**
    * Join an array of strings into one delimited string.
    *
    * @param buff    String buffered used for join (buffer is not reset).
    * @param array   Array of objects to join as strings.
    * @param delim   Delimiter to join strings with or <i>null</i>.
    * @return        Joined string.
    */
Join an array of strings into one delimited string.
@param buff    String buffered used for join (buffer is not reset).
@param array   Array of objects to join as strings.
@param delim   Delimiter to join strings with or null.
@return        Joined string.
Join an array of strings into one delimited string . @param buff String buffered used for join ( buffer is not reset ) . @param array Array of objects to join as strings . @param delim Delimiter to join strings with or null . @return Joined string .
public static String join(final StringBuffer buff, final Object array[],
      final String delim)
   {
      boolean haveDelim = (delim != null);
      for (int i = 0; i < array.length; i++)
      {
         buff.append(array[i]);
         if (haveDelim && (i + 1) < array.length)
         {
            buff.append(delim);
         }
      }
      return buff.toString();
   }
public static String join ( final StringBuffer buff , final Object array [ ] , final String delim ) { boolean haveDelim = ( delim != null ) ; for ( int i = 0 ; i < array . length ; i ++ ) { buff . append ( array [ i ] ) ; if ( haveDelim && ( i + 1 ) < array . length ) { buff . append ( delim ) ; } } return buff . toString ( ) ; }
Join an array of strings into one delimited string.
Join an array of strings into one delimited string .
// if this is the last element then don't append delim