1. 程式人生 > >String根據符號分割成list

String根據符號分割成list

        String ids = "";
        List<String> list = new ArrayList<String>();
        Collections.addAll(list, StringUtils.splitByWholeSeparator(ids, ","));

需要匯入commons-lang-2.6.jar



List迴圈

    public void init(List ids) {
        for (Object id : ids) {
            String userId = id.toString();
        }
    }