Here you can find the source of split(String str, String splitStr)
public static String[] split(String str, String splitStr)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String[] split(String str, String splitStr) { List<String> dataList = new ArrayList<String>(); int indx = str.indexOf(splitStr); while (indx >= 0) { dataList.add(str.substring(0, indx)); str = str.substring(indx + splitStr.length()); indx = str.indexOf(splitStr); }/*w w w . ja v a 2 s . co m*/ dataList.add(str); String[] datas = new String[dataList.size()]; for (int i = 0; i < dataList.size(); i++) { datas[i] = dataList.get(i); } return datas; } }