org.urhl7.utils
Class StringHelper

java.lang.Object
  extended by org.urhl7.utils.StringHelper

public class StringHelper
extends Object

StringHelper is a class that contains utility methods to manipulate strings.


Method Summary
static String[] explode(String data, String delim)
          Operates a lot like the split function on String, but does not require the delimiter to be a regular expression (this does not matter much, except when dynamically loading the delim that may have regular expression special chars in it).
static String implode(String[] ary, String delim)
          Duplicates PHP's "implode" functionality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

explode

public static String[] explode(String data,
                               String delim)
Operates a lot like the split function on String, but does not require the delimiter to be a regular expression (this does not matter much, except when dynamically loading the delim that may have regular expression special chars in it).

Parameters:
data - the data to split
delim - the delimiting string to use
Returns:
an array of strings, without the delimiter

implode

public static String implode(String[] ary,
                             String delim)
Duplicates PHP's "implode" functionality. Will glue an array of strings together with the delimiter:
foo[0] = "Dave,";
foo[1] = "hello";
foo[2] = "world";
implode(foo, " ") => "Dave, hello world"

Parameters:
ary - the array of strings to glue
delim - the glue
Returns:
the imploded string