net.livesite.util
Class Join

java.lang.Object
  extended by net.livesite.util.Join

public class Join
extends Object

A join concetenates a list if items with a delimiter. This example builds the path: /usr/local/bin:

  String[] pathElements = { "/usr", "local", "bin" };
  String path = Join.strings(File.separator, pathElements);
 
A shortcut for inlining the array is written as:
  String path = Join.strings(File.separator, 
      new String[] { "/usr", "local", "bin" });
 
In Java 5 and up, the above can be written using Varargs:
  String path = Join.strings(File.separator, "/usr", "local", "bin");
 

Author:
Ryan Gies

Constructor Summary
Join()
           
 
Method Summary
static String strings(String delimiter, String[] strings)
          Join an array of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Join

public Join()
Method Detail

strings

public static String strings(String delimiter,
                             String[] strings)
Join an array of strings.

Parameters:
delimiter -
strings - to join
Returns:
concatenated string