Here you can find the source of strToList(String str, String regex)
public static List<String> strToList(String str, String regex)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> strToList(String str, String regex) { List<String> list = new ArrayList<String>(); if (str.length() == 0 && "".equals(str)) { return list; } else if (str.length() == 1) { list.add(str);//from ww w . ja v a 2 s . c om return list; } String temp[] = str.split(regex); for (String temp_ : temp) { list.add(temp_); } return list; } }