Here you can find the source of splitByStr(String s, String delim)
public static List<String> splitByStr(String s, String delim)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static List<String> splitByStr(String s, String delim) { if (isEmpty(s)) return Collections.emptyList(); ArrayList<String> tokens = new ArrayList<String>(); int i = 0; while (i < s.length()) { int j = s.indexOf(delim, i); if (j == -1) break; tokens.add(s.substring(i, j)); i = j + delim.length();//from ww w. j av a2s. co m } tokens.add(s.substring(i)); return tokens; } public static boolean isEmpty(String s) { return s == null || s.equals(""); } }