Here you can find the source of toArray(String s)
public static String[] toArray(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String[] toArray(String s) { return toArray(s, ","); }// ww w .ja v a2 s. co m public static String[] toArray(String s, String delim) { if (isNull(s)) return new String[0]; return s.split(delim); } public static boolean isNull(Object s) { if (s == null || s.toString().trim().length() == 0 || s.equals("null")) return true; else return false; } }