• 把以逗号分隔的字符串转换成list


    /**
         * 把省的字符串转换成列表
         * 
         * @param province
         * @return
         */
        private List<String> getProvinceList(String province) {
            List<String> result = new ArrayList<>();
            if (StringUtils.isEmpty(province)) {
                return result;
            }
            int index = 0;
            int currIndex = province.indexOf(Constants.COMMA, index);
            if (currIndex > -1) {
                while (currIndex > -1 || index < province.length()) {
                    String str = "";
                    if (currIndex < 0) {
                        str = province.substring(index, province.length());
                        currIndex = index + str.length();
                    } else {
                        str = province.substring(index, currIndex);
                    }
                    if (StringUtils.isNoneBlank(str)) {
                        result.add(str);
                    }
                    index = ++currIndex;
                    currIndex = province.indexOf(Constants.COMMA, index);
                }
            } else {
                result.add(province);
            }
            return result;
        }
  • 相关阅读:
    urlencode 和 rawurlencode 的区别
    magic_quotes_gpc
    变量的值是多少
    git diff patch
    drupal前端开发的第一点
    git drupal eclipse
    spm总结
    features block
    alu features menu
    git reset 理解
  • 原文地址:https://www.cnblogs.com/nizuimeiabc1/p/8137493.html
Copyright © 2020-2023  润新知