Here you can find the source of split(final String s)
public static String[] split(final String s)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static String[] split(final String s) { if (s == null) { return null; }//ww w . j a v a 2 s . c o m final List<String> l = new ArrayList<String>(); for (final String i : s.split(",")) { if (i == null) { continue; } final String sp = i.trim(); if (sp.length() == 0) { continue; } l.add(sp); } return l.toArray(new String[0]); } public static String[] split(final String s, final String sep) { if (s == null) { return null; } final List<String> l = new ArrayList<String>(); for (final String i : s.split(sep)) { if (i == null) { continue; } final String sp = i.trim(); if (sp.length() == 0) { continue; } l.add(sp); } return l.toArray(new String[0]); } }