Java Utililty Methods String Tokenize

List of utility methods to do String Tokenize

Description

The list of methods to do String Tokenize are organized into topic(s).

Method

ArrayListTokenize(String sent)
Tokenize
ArrayList<String> result = new ArrayList<String>();
String tokens[] = sent.split(SPLIT_TOKENS);
for (String token : tokens) {
    token = token.trim().toLowerCase();
    if (token.length() == 0)
        continue;
    result.add(token);
return result;
String[]tokenize(String sentence)
Take a string and tokenize it using " " and "--" as delimiters into an Array of Strings.
List<String> tokens = new ArrayList<String>();
int pos = 0;
String temp;
boolean alive = true;
while (alive) {
    int nextSpace = sentence.indexOf(' ', pos);
    int nextDDash = sentence.indexOf("--", pos);
    if (nextSpace == nextDDash + 2) {
...
String[]tokenize(String source, char separator)
Break up a string into tokens This method will take a source string and break it into substrings.
if (source == null) {
    return null;
int slen = source.length();
String[] scratch = new String[slen + 1]; 
int ntokens = 0;
int start = 0;
while (true) {
...
String[]tokenize(String source, char separator)
Tokenizes a string and takes into account escaping.
if (source == null) {
    return null;
int length = source.length();
ArrayList result = new ArrayList();
StringBuffer currentString = new StringBuffer();
char c;
int state = STATE_DEFAULT;
...
Listtokenize(String str, char delim)
tokenize
ArrayList<String> result = new ArrayList<String>();
StringBuilder current = new StringBuilder();
boolean escaped = false;
for (int i = 0; i < str.length(); i++) {
    char c = str.charAt(i);
    if (c == delim) {
        if (escaped) {
            current.append(c);
...
Vectortokenize(String str, String delims)
Split a string in a list of tokens delimited by a specified character.
Vector<String> out = new Vector<String>();
if (str == null || str.length() == 0 || delims == null || delims.length() == 0)
    return out;
StringBuilder token = new StringBuilder(str.length());
for (int i = 0; i < str.length(); i++) {
    if (delims.indexOf(str.charAt(i)) != -1) {
        if (token.length() > 0) {
            out.addElement(token.toString());
...
Listtokenize(String str, String delims, boolean returnDelims)
tokenize
List<String> list = new ArrayList<String>();
if (str != null && str.length() > 0) {
    StringTokenizer tok = (delims == null ? new StringTokenizer(str)
            : new StringTokenizer(str, delims, returnDelims));
    while (tok.hasMoreTokens()) {
        list.add(tok.nextToken());
return list;
String[]tokenize(String string, String splitOn)
Tokenize the passed in string.
return string.replace(" ", "").split(splitOn);
Listtokenize(String text)
tokenize
List<String> results = Arrays.asList(text.split("\\s"));
return results;
String[]tokenize(String text)
tokenize
boolean esc = false;
boolean inString = false;
ArrayList<String> tokens = new ArrayList<String>();
StringBuilder buf = new StringBuilder();
char[] chars = text.toCharArray();
for (char c : chars) {
    if (esc) {
        switch (c) {
...