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 Details

    • StringSplitter

      public StringSplitter()
  • Method Details

    • 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.