org.graffiti.util
Class StringSplitter

java.lang.Object
  extended by org.graffiti.util.StringSplitter

public class StringSplitter
extends Object

Provides a method to split a String into several Strings according to a certain String.

Version:
$Revision: 5767 $

Constructor Summary
StringSplitter()
           
 
Method Summary
static String[] split(String toSplit, String delim)
          Splits String toSplit using delim as delimeter.
static String[] split(String toSplit, String delim, int limit)
          Splits String toSplit using delim as delimeter.
static String[] splitInTwo(String toSplit, String delim)
          Splits String toSplit using delim as delimeter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringSplitter

public StringSplitter()
Method Detail

split

public static String[] split(String toSplit,
                             String delim)
Splits String toSplit using delim as delimeter. Fills the returned String array with the results. If delim does not appear in toSplit, the whole String is returned as first entry of the returned String array.

Parameters:
toSplit - the String that is split.
delim - the String that is used as delimiter.
Returns:
the parts of the String in a String array.

split

public static String[] split(String toSplit,
                             String delim,
                             int limit)
Splits String toSplit using delim as delimeter. Splits into a maximum of limit Strings. Fills the returned String array with the results. If delim does not appear in toSplit, the whole String is returned as first entry of the returned String array.

Parameters:
toSplit - the String that is split.
delim - the String that is used as delimiter.
limit - the maximum number of resulting Strings
Returns:
the parts of the String in a String array.

splitInTwo

public static String[] splitInTwo(String toSplit,
                                  String delim)
Splits String toSplit using delim as delimeter. Splits into a maximum of 2 Strings. Fills the returned String array with the results. If delim does not appear in toSplit, the whole String is returned as first entry of the returned String array. This method is faster than a call to split(toSplit, delim, 2), but otherwise has the same result.

Parameters:
toSplit - the String that is split.
delim - the String that is used as delimiter.
Returns:
the parts of the String in a String array.


Generated at 2012-05-30 11:00:36 PM CEST