Java String Tokenize getTokens(String string)

Here you can find the source of getTokens(String string)

Description

Returns a list of tokens based on the given string.

License

Open Source License

Parameter

Parameter Description
string the string.

Return

the list of tokens.

Declaration

public static List<String> getTokens(String string) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;
import java.util.Arrays;

import java.util.List;

public class Main {
    /**//from   www  .  j a  v  a 2  s  . c  om
     * Returns a list of tokens based on the given string.
     * 
     * @param string the string.
     * @return the list of tokens.
     */
    public static List<String> getTokens(String string) {
        if (string == null) {
            return null;
        }

        return new ArrayList<>(Arrays.asList(string.split("\\s")));
    }
}

Related

  1. getTokenArray(String sequence, String[] chain, boolean paired, boolean includeDelim)
  2. getTokens(final String s)
  3. getTokens(String msg, String delim)
  4. getTokens(String str, String delim)
  5. getTokens(String str, String delimiter)
  6. getTokens(String string)
  7. getTokens(String string, String tokenSeparator)
  8. getTokens(String value)
  9. getTokens(String vbt)