Java Array From toArray(String emails)

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

Description

Helper method to convert comma delimeted list of email strings to array

License

Open Source License

Parameter

Parameter Description
emails a parameter

Return

array

Declaration

public static String[] toArray(String emails) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//w ww  .  j av  a2 s .  c om
     * Helper method to convert comma delimeted list of email strings to array
     * @param emails
     * @return array
     */
    public static String[] toArray(String emails) {
        if (emails == null)
            return new String[0];

        String[] tmp = emails.split(",");
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = tmp[i].trim();
        }
        return tmp;
    }
}

Related

  1. toArray(Object foo)
  2. toArray(Object o)
  3. toArray(Object... args)
  4. toArray(Object... values)
  5. toArray(String array)
  6. toArray(String number)
  7. toArray(String s)
  8. toArray(String s)