/** * Splits a string into tokens, separated by the given delimiter. The * delimiter is not included in the resulting list, nor is it part of any of * the resulting tokens, except if there would be more tokens than maxTokens * would allow, in which case the last resulting token will contain some * delimiters. *
* If wantEmptyTokens is true, the last token
* may also start with some of the delimiters which would otherwise mark
* empty tokens.
*
* @param input
* The string to split.
* @param delimiter
* The character used to separate tokens in the input string.
* @param maxTokens
* Maximum number of tokens to return. If there are less tokens
* than this value, or as many as this value specifies, they are
* all returned. If there would be more tokens, the last token
* contains the rest of the string, including all delimiters
* within it.
* If this value is zero or negative, then all instances of
* the delimiter are considered to be split points.
* @param wantEmptyTokens
* true if consecutive delimiters must generate
* empty tokens; false to output only tokens of
* length 1 or more.
* @return List of tokens found within the input string.
*/
public static List