Here you can find the source of tokenize(String input)
Parameter | Description |
---|---|
input | is a line to be tokenized |
public static String[] tokenize(String input)
//package com.java2s; public class Main { /**//from w w w . ja v a2 s .co m * Tokenizing helper. Works on space, tab and comma separated files. * * @param input is a line to be tokenized * @return a String[] of the strings in between the delimiters */ public static String[] tokenize(String input) { if (input.contains(",")) { // comma delimited String[] ret = input.split(","); // trim leading whitespace for (String s : ret) { s.trim(); } return ret; } else if (input.contains("\\t")) { // tab delimited return input.split("\\t+"); } else { // whitespace delimited return input.trim().split("\\s+"); } } }