Here you can find the source of split(String splittee, String splitChar)
public static String[] split(String splittee, String splitChar)
//package com.java2s; import java.util.*; public class Main { public static String[] split(String splittee, String splitChar) { return split(splittee, splitChar, 0); }// w w w. ja v a 2s. c o m /** * String split method * @param splittee input string * @param splitChar split text * @param limit split limit number * @return String[] */ public static String[] split(String splittee, String splitChar, int limit) { String taRetVal[]; StringTokenizer toTokenizer; int tnTokenCnt; try { toTokenizer = new StringTokenizer(splittee, splitChar); tnTokenCnt = toTokenizer.countTokens(); if (limit != 0 && tnTokenCnt > limit) tnTokenCnt = limit; taRetVal = new String[tnTokenCnt]; for (int i = 0; i < tnTokenCnt; i++) { if (toTokenizer.hasMoreTokens()) { taRetVal[i] = toTokenizer.nextToken(); } if (limit != 0 && limit == (i + 1)) break; } } catch (Exception e) { taRetVal = new String[0]; } return taRetVal; } }