Here you can find the source of getAllTokens(final String string)
Parameter | Description |
---|---|
string | the string to tokenize. |
public static String[] getAllTokens(final String string)
//package com.java2s; import java.util.*; public class Main { /**//from w w w.j a v a 2 s . c o m * Separator string for lists. */ public static final String LIST_SEPARATOR = ","; /** * Applies StringTokenizer to the string and returns all the tokens found. * * @param string the string to tokenize. * @return all the tokens found in string. */ public static String[] getAllTokens(final String string) { return getAllTokens(string, LIST_SEPARATOR); } /** * Applies StringTokenizer to the string and returns all the tokens found. * * @param string the string to tokenize. * @param separator the separator for the tokens. * @return all the tokens found in string. */ public static String[] getAllTokens(final String string, final String separator) { final StringTokenizer tokenizer = new StringTokenizer(string, separator); final String[] tokens = new String[tokenizer.countTokens()]; for (int i = 0; i < tokens.length; ++i) tokens[i] = tokenizer.nextToken().trim(); return tokens; } }