return str.split(regex);
String[] strings = str.split(regex); for (int i = 0; i < strings.length; i++) { strings[i] = strings[i].trim(); } return strings;
    public static String[] splitString(String str, String regex)    {        try {            if ( str != null && regex != null ) {                return str.split(regex);            }        } catch (PatternSyntaxException ex) {            LOG.log(Level.WARNING, "Exception while splitting string", ex);        }                return null;    }