Java String Tokenize tokenizeLine(String input)

Here you can find the source of tokenizeLine(String input)

Description

tokenize Line

License

Open Source License

Declaration

public static List<String> tokenizeLine(String input) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> tokenizeLine(String input) {
        List<String> retn = new ArrayList<String>();

        if (input == null || input.length() == 0)
            return retn;

        String temp = input;/*from   w  w  w  .ja  v a  2  s . c om*/

        while (true) {
            if (temp.startsWith(":") && retn.size() > 0) {
                retn.add(temp.substring(1));

                return retn;
            }

            String[] split = temp.split(" ", 2);
            retn.add(split[0]);

            if (split.length > 1)
                temp = split[1];
            else
                break;
        }

        return retn;
    }
}

Related

  1. tokenizeAutocomplete(String text, int minSize)
  2. tokenizeClassName(final String className)
  3. tokenizeDirectiveCall(String data)
  4. tokenizeExpression(String s)
  5. tokenizeFilter(CharSequence filter)
  6. tokenizeLine(String line)
  7. tokenizeName(String name)
  8. tokenizeNumbersFromString(String stream)
  9. tokenizeOnWhitespace(String input)