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

String[]tokenizeExpression(String s)
Crude expression tokenizer - will not work for complex expresions but may suffice for most
String[] ret;
List tokens = new ArrayList();
int SLength = s.length();
StringBuffer accum = new StringBuffer(SLength);
int accumType = NOT_ACCUMULATING;
for (int i = 0; i < SLength; i++) {
    char c = s.charAt(i);
    if (accumType == NOT_ACCUMULATING) {
...
ListtokenizeFilter(CharSequence filter)
tokenize Filter
final int length = filter.length();
final List<String> result = new ArrayList();
final StringBuilder token = new StringBuilder();
boolean quoted = false;
for (int i = 0; i < length; i++) {
    final char c = filter.charAt(i);
    if (Character.isWhitespace(c) && !quoted) {
        if (token.length() > 0) {
...
ListtokenizeLine(String input)
tokenize Line
List<String> retn = new ArrayList<String>();
if (input == null || input.length() == 0)
    return retn;
String temp = input;
while (true) {
    if (temp.startsWith(":") && retn.size() > 0) {
        retn.add(temp.substring(1));
        return retn;
...
LinkedListtokenizeLine(String line)
tokenize Line
String[] elementsArray = line.split(" ");
LinkedList<String> elementsList = new LinkedList<String>(Arrays.asList(elementsArray));
while (elementsList.remove("")) {
return elementsList;
String[]tokenizeName(String name)
tokenize Name
char[] nameChars = name.toCharArray();
char[][] tokens = new char[][] { new char[nameChars.length], new char[nameChars.length],
        new char[nameChars.length] };
boolean delimiter = false;
int token = 0;
int index = 0;
for (int i = 0; i < nameChars.length; i++) {
    if (nameChars[i] == '"') {
...
ArrayListtokenizeNumbersFromString(String stream)
tokenize Numbers From String
ArrayList<String> output = new ArrayList<String>();
boolean flag;
for (int i = 0; i < stream.length(); i++) {
    String str = new String();
    flag = false;
    if (isNumber(stream.charAt(i)))
        flag = true;
    while (i < stream.length() && isNumber(stream.charAt(i)))
...
String[]tokenizeOnWhitespace(String input)
tokenize On Whitespace
ArrayList<String> out = new ArrayList<String>();
int mark = -1;
for (int i = 0; i < input.length(); i++) {
    if (Character.isWhitespace(input.charAt(i))) {
        if (i - mark > 1) {
            out.add(input.substring(mark + 1, i));
        mark = i;
...
String[]tokenizePath(String path)
tokenize Path
ArrayList alist = new ArrayList();
StringTokenizer tokenizer = new StringTokenizer(path, ".");
while (tokenizer.hasMoreTokens()) {
    alist.add(tokenizer.nextToken());
return (String[]) alist.toArray(new String[alist.size()]);
String[]tokenizePathAsArray(String path)
Same as #tokenizePath tokenizePath but hopefully faster.
char sep = FILE_SEP_CHAR;
int start = 0;
int len = path.length();
int count = 0;
for (int pos = 0; pos < len; pos++) {
    if (path.charAt(pos) == sep) {
        if (pos != start) {
            count++;
...
String[]tokenizePattern(String pattern)
tokenize Pattern
final String[] filter = pattern.split(",");
for (int i = 0; i < filter.length; i++) {
    filter[i] = filter[i].trim();
return filter;