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 StringtoSplit
usingdelim
as delimeter.static String[]
split(String toSplit, String delim, int limit)
Splits StringtoSplit
usingdelim
as delimeter.static String[]
splitInTwo(String toSplit, String delim)
Splits StringtoSplit
usingdelim
as delimeter.
-
Constructor Details
-
StringSplitter
public StringSplitter()
-
-
Method Details
-
split
Splits StringtoSplit
usingdelim
as delimeter. Fills the returned String array with the results. Ifdelim
does 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 StringtoSplit
usingdelim
as delimeter. Splits into a maximum oflimit
Strings. Fills the returned String array with the results. Ifdelim
does 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 StringtoSplit
usingdelim
as delimeter. Splits into a maximum of 2 Strings. Fills the returned String array with the results. Ifdelim
does 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.
-