Here you can find the source of split(String str, char separatorChar)
public static String[] split(String str, char separatorChar)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static String[] split(String str, char separatorChar) { if (str == null) { return null; }/*from w w w . j a v a2 s . c o m*/ int length = str.length(); if (length == 0) { return new String[0]; } List<String> list = new ArrayList<String>(); int i = 0; int start = 0; while (i < length) { if (str.charAt(i) == separatorChar) { list.add(str.substring(start, i)); start = ++i; continue; } i++; } list.add(str.substring(start, i)); return list.toArray(new String[list.size()]); } }