Java Array From toArray(String s)

Here you can find the source of toArray(String s)

Description

to Array

License

Apache License

Declaration

public static String[] toArray(String s) 

Method Source Code

//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;
    }
}

Related

  1. toArray(Object... values)
  2. toArray(String array)
  3. toArray(String emails)
  4. toArray(String number)
  5. toArray(String s)