Here you can find the source of splitSubstring(String str, String substr)
public static ArrayList<String> splitSubstring(String str, String substr)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static ArrayList<String> splitSubstring(String str, String substr) { ArrayList<String> split = new ArrayList<String>(); int idx_s = 0; int idx_e = str.indexOf(substr); while (idx_e > -1) { String f = str.substring(idx_s, idx_e); split.add(f.trim());/*from w w w.j a va 2 s .co m*/ idx_s = idx_e + substr.length(); idx_e = str.indexOf(substr, idx_s); } if (idx_s < str.length()) { String f = str.substring(idx_s).trim(); split.add(f); } //System.out.println("split.toString() = " + split.toString()); return split; } }