Here you can find the source of extractCommaItems(List
public static int extractCommaItems(List<String> list, String tags)
//package com.java2s; /** This class is a PanelLeft factory, creating all panels based on the * contents of the panels.xml file./*w ww.j a va 2s .co m*/ * * Last Updated: May 25, 2011 * * by Rick C. Hodgin * Cossatot Analytics Laboratories, LLC. (Cana Labs) * * (c) Copyright Cana Labs. * Free software licensed under the GNU GPL2. * * @author Rick C. Hodgin * @version 1.0.0 * * Change history: * 2011-05-25 - 1.0.0 - Initial release * */ import java.util.List; public class Main { public static int extractCommaItems(List<String> list, String tags) { int count, offset; String tag; count = 0; while (!tags.isEmpty()) { offset = tags.indexOf(","); if (offset >= 0) { tag = tags.substring(0, offset).trim(); tags = tags.substring(tag.length() + 1).trim(); } else { tag = tags.trim(); tags = ""; } ++count; list.add(tag); } return (count); } }