Package org.graffiti.util
Class StringSplitter
java.lang.Object
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: 1.4 $
-
Constructor Summary
Constructors Constructor Description StringSplitter() -
Method Summary
Modifier and Type Method Description static String[]split(String toSplit, String delim)Splits StringtoSplitusingdelimas delimeter.static String[]split(String toSplit, String delim, int limit)Splits StringtoSplitusingdelimas delimeter.static String[]splitInTwo(String toSplit, String delim)Splits StringtoSplitusingdelimas delimeter.
-
Constructor Details
-
StringSplitter
public StringSplitter()
-
-
Method Details
-
split
Splits StringtoSplitusingdelimas delimeter. Fills the returned String array with the results. Ifdelimdoes not appear intoSplit, 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
Splits StringtoSplitusingdelimas delimeter. Splits into a maximum oflimitStrings. Fills the returned String array with the results. Ifdelimdoes not appear intoSplit, 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
Splits StringtoSplitusingdelimas delimeter. Splits into a maximum of 2 Strings. Fills the returned String array with the results. Ifdelimdoes not appear intoSplit, the whole String is returned as first entry of the returned String array. This method is faster than a call tosplit(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.
-