Here you can find the source of tokenize(String text, String delimiter)
public static List<String> tokenize(String text, String delimiter)
//package com.java2s; /**//from w ww.ja va2s.c om * The Clican-Pluto software suit is Copyright 2009, Clican Company * and individual contributors, and is licensed under the GNU LGPL. * * @author clican * */ import java.util.ArrayList; import java.util.List; public class Main { public static List<String> tokenize(String text, String delimiter) { if (delimiter == null) { throw new RuntimeException("delimiter is null"); } if (text == null) { return new ArrayList<String>(); } List<String> pieces = new ArrayList<String>(); int start = 0; int end = text.indexOf(delimiter); while (end != -1) { pieces.add(text.substring(start, end)); start = end + delimiter.length(); end = text.indexOf(delimiter, start); } if (start < text.length()) { pieces.add(text.substring(start)); } return pieces; } }