Here you can find the source of stringToList(String str, String delim)
public static List stringToList(String str, String delim)
//package com.java2s; /**/* www. ja v a 2s .c o m*/ * Copyright (c) 2003,2004 International Business Machines Corporation. * All Rights Reserved. * * This software is provided and licensed under the terms and conditions * of the Common Public License: * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html */ import java.util.*; public class Main { public static List stringToList(String str, String delim) { return Arrays.asList(tokenize(str, delim)); } public static String[] tokenize(String tokenStr, String delim) { StringTokenizer strTok = new StringTokenizer(tokenStr, delim); String[] tokens = new String[strTok.countTokens()]; for (int i = 0; i < tokens.length; i++) { tokens[i] = strTok.nextToken(); } return tokens; } }