src/main/java/org/jboss/util/Strings.java
/**
    * Tokenize the given String into a String array via a StringTokenizer.
    *
    * The given delimiters string is supposed to consist of any number of
    * delimiter characters. Each of those characters can be used to separate
    * tokens. A delimiter is always a single character; for multi-character
    * delimiters, consider using delimitedListToStringArray
    *
    * @param str               the String to tokenize
    * @param delimiters        the delimiter characters, assembled as String
    *                          (each of those characters is individually considered as delimiter)
    * @param trimTokens        trim the tokens via String's trim
    * @param ignoreEmptyTokens omit empty tokens from the result array
    *                          (only applies to tokens that are empty after trimming; StringTokenizer
    *                          will not consider subsequent delimiters as token in the first place).
    * @return an array of the tokens (null if the input String was null)
    */
Tokenize the given String into a String array via a StringTokenizer.
The given delimiters string is supposed to consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character; for multi-character
delimiters, consider using delimitedListToStringArray

@param str               the String to tokenize
@param delimiters        the delimiter characters, assembled as String
(each of those characters is individually considered as delimiter)
@param trimTokens        trim the tokens via String's trim
@param ignoreEmptyTokens omit empty tokens from the result array
(only applies to tokens that are empty after trimming; StringTokenizer
will not consider subsequent delimiters as token in the first place).
@return an array of the tokens (null if the input String was null)
Tokenize the given String into a String array via a StringTokenizer . The given delimiters string is supposed to consist of any number of delimiter characters . Each of those characters can be used to separate tokens . A delimiter is always a single character ; for multi - character delimiters consider using delimitedListToStringArray @param str the String to tokenize @param delimiters the delimiter characters assembled as String ( each of those characters is individually considered as delimiter ) @param trimTokens trim the tokens via String ' s trim @param ignoreEmptyTokens omit empty tokens from the result array ( only applies to tokens that are empty after trimming ; StringTokenizer will not consider subsequent delimiters as token in the first place ) . @return an array of the tokens ( null if the input String was null )
public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens)
   {
      if (str == null)
      {
         return null;
      }
      StringTokenizer st = new StringTokenizer(str, delimiters);
      List<String> tokens = new ArrayList<String>();
      while (st.hasMoreTokens())
      {
         String token = st.nextToken();
         if (trimTokens)
         {
            token = token.trim();
         }
         if (!ignoreEmptyTokens || token.length() > 0)
         {
            tokens.add(token);
         }
      }
      return tokens.toArray(new String[tokens.size()]);
   }
public static String [ ] tokenizeToStringArray ( String str , String delimiters , boolean trimTokens , boolean ignoreEmptyTokens ) { if ( str == null ) { return null ; } StringTokenizer st = new StringTokenizer ( str , delimiters ) ; List < String > tokens = new ArrayList < String > ( ) ; while ( st . hasMoreTokens ( ) ) { String token = st . nextToken ( ) ; if ( trimTokens ) { token = token . trim ( ) ; } if ( ! ignoreEmptyTokens || token . length ( ) > 0 ) { tokens . add ( token ) ; } } return tokens . toArray ( new String [ tokens . size ( ) ] ) ; }
Tokenize the given String into a String array via a StringTokenizer.
Tokenize the given String into a String array via a StringTokenizer .