Here you can find the source of explode(String original, String split)
public static String[] explode(String original, String split)
//package com.java2s; import java.util.ArrayList; public class Main { public static String[] explode(String original, String split) { if (original == null || original.length() == 0 || split == null || split.length() == 0) { return new String[] { original }; }// w ww. j av a 2 s . c om ArrayList<String> strs = new ArrayList<String>(); int index = 0; int len = split.length(); while ((index = original.indexOf(split)) != -1) { strs.add(original.substring(0, index)); original = original.substring(index + len); } strs.add(original); return strs.toArray(new String[0]); } }