Here you can find the source of split(String s, char delim)
public static ArrayList<String> split(String s, char delim)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static ArrayList<String> split(String s, char delim) { ArrayList<String> rv = new ArrayList<String>(); int length = s.length(); int cur = -1; int next; if (length == 0) { return rv; }/*from w w w. j a v a2s .co m*/ while (true) { next = s.indexOf(delim, cur + 1); if (next == -1) { rv.add(s.substring(cur + 1)); break; } else if (next == length - 1) { rv.add(s.substring(cur + 1, next)); break; } else { rv.add(s.substring(cur + 1, next)); cur = next; } } return rv; } }