Here you can find the source of tokenize(String text, char separator)
public static List<String> tokenize(String text, char separator)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004-2010 Sunil Kamath (IcemanK). * All rights reserved./*from ww w. j a va 2s . c om*/ * This program is made available under the terms of the Common Public License * v1.0 which is available at http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * Sunil Kamath (IcemanK) - initial API and implementation *******************************************************************************/ import java.util.*; public class Main { public static List<String> tokenize(String text, char separator) { List<String> list = new ArrayList<String>(); if (text != null && text.length() > 0) { char[] chars = text.toCharArray(); StringBuffer buf = new StringBuffer(""); //$NON-NLS-1$ for (int i = 0; i < chars.length; i++) { if (chars[i] != separator) { buf.append(chars[i]); } else { list.add(buf.toString()); buf.delete(0, buf.length()); } } list.add(buf.toString().trim()); } return list; } }