Here you can find the source of split(String str)
public static String[] split(String str)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String[] split(String str) { char[] chars = str.toCharArray(); List<String> tokens = new ArrayList<>(); StringBuilder buf = new StringBuilder(); for (char aChar : chars) { if ((aChar >= 'a' && aChar <= 'z') || aChar == '\'') { buf.append(aChar);/*from w ww . j av a 2 s .c o m*/ } else { if (buf.length() > 0) { tokens.add(buf.toString()); buf = new StringBuilder(); } } } if (buf.length() > 0) { tokens.add(buf.toString()); } return tokens.toArray(new String[0]); } }