Java tutorial
//package com.java2s; import java.util.*; import java.util.regex.*; public class Main { public static String[] parseStringList(String list) { // final Pattern patWs = Pattern.compile("\\s+"); final Matcher matchWs = Pattern.compile("[^\\s]+").matcher(""); matchWs.reset(list); LinkedList<String> matchList = new LinkedList<String>(); while (matchWs.find()) { matchList.add(matchWs.group()); } String[] retArr = new String[matchList.size()]; return (String[]) matchList.toArray(retArr); } }