Here you can find the source of split(String s, char separator)
public static String[] split(String s, char separator)
//package com.java2s; // under the terms of the GNU Lesser General Public License as published import java.util.ArrayList; public class Main { public static String[] split(String s, char separator) { // this is meant to be faster than String.split() when separator is not regexp if (s == null) return null; ArrayList<String> parts = new ArrayList<String>(); int beginIndex = 0, endIndex; while ((endIndex = s.indexOf(separator, beginIndex)) >= 0) { parts.add(s.substring(beginIndex, endIndex)); beginIndex = endIndex + 1;// w w w .j av a 2s. c o m } parts.add(s.substring(beginIndex)); String[] a = new String[parts.size()]; return parts.toArray(a); } }