Java Comma Separated List extractCommaItems(List list, String tags)

Here you can find the source of extractCommaItems(List list, String tags)

Description

extract Comma Items

License

GNU General Public License

Declaration

public static int extractCommaItems(List<String> list, String tags) 

Method Source Code

//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);
    }
}

Related

  1. commaSepLineToList(String commSepLine)
  2. commaStringToList(String inputString)
  3. convertCommaDelimitedStringToList(String s)
  4. ConvertDiscussionGroupListToCommaString( List list)
  5. convertToStringList(String valuesCommaSeparated)
  6. extractCommandsFromLine(final String line, final String delimiter, final StringBuilder bufferedCommand, final List extractedCommands)
  7. formatCommand(List arguments)
  8. getAsCommaDelimitedString(List coll)
  9. getCommaList(List V)