Here you can find the source of recursiveSplit(String str, String splitor)
public static List<String> recursiveSplit(String str, String splitor)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> recursiveSplit(String str, String splitor) { List<String> re = new ArrayList<String>(); String[] strs = twoPartSplit(str, splitor); if (strs.length == 2) { re.add(strs[0]);// ww w .j av a2 s.c o m re.addAll(recursiveSplit(strs[1], splitor)); } else { re.add(strs[0]); } return re; } public static String[] twoPartSplit(String str, String splitor) { if (str != null && splitor != null) { int index = str.indexOf(splitor); if (index != -1) { String first = str.substring(0, index); String sec = str.substring(index + splitor.length()); return new String[] { first, sec }; } else { return new String[] { str }; } } else { return new String[] { str }; } } }