Here you can find the source of stringToList(String delimitedString)
Parameter | Description |
---|---|
delimitedString | a parameter |
public static List<String> stringToList(String delimitedString)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { /**/* w w w . j a v a2s .co m*/ * Converts a comma delimited String into a List<String> * @param delimitedString * @return the List. */ public static List<String> stringToList(String delimitedString) { List<String> result = new ArrayList<String>(); try { for (String s : Arrays.asList(delimitedString.split(","))) { result.add(s.trim()); } } catch (Exception e) { result = new ArrayList<String>(); } return result; } }