Java String to List stringToList(String content, String splitter)

Here you can find the source of stringToList(String content, String splitter)

Description

split the string to tokens by splitter

License

Apache License

Parameter

Parameter Description
content a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static List<String> stringToList(String content, String splitter) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**/*from w w  w .  j  a  v a 2 s .c o  m*/
     * split the string to tokens by splitter
     * @param content
     * @return
     * @throws IOException
     */
    public static List<String> stringToList(String content, String splitter) {
        List<String> list = new ArrayList<String>();
        String[] segs = content.split(splitter);
        for (String seg : segs) {
            list.add(seg.trim());
        }
        return list;
    }
}

Related

  1. stringToBooleanList(final String str, final boolean[] listData)
  2. stringToIntegerList(String input)
  3. stringToItems(List fontsList, boolean useSeparator)
  4. stringToList(final String string)
  5. stringToList(String content)
  6. stringToList(String delimitedString)
  7. stringToList(String input)
  8. stringToList(String keywords, String delimiter)
  9. stringToList(String listString, String delimiter)