import java.util.*; import java.util.regex.*; public class Split { public static void main(String[] args) { String str = " a b c d "; Pattern p = Pattern.compile(" "); Matcher m = p.matcher(str); //保存结果数组 List<String> ret = new ArrayList<String>(); //临时变量 String temp = null; int index = 0; while(m.find()) { int start = m.start(); temp = str.substring(index, start); ret.add(temp); index = m.end(); } System.out.println(ret); } }