牛骨文教育服务平台(让学习变的简单)
博文笔记

JAVA,截取字符串,存放在数组中

创建时间:2012-10-08 投稿人: 浏览次数:168

List<String> selectIdsArray = new ArrayList<String>();


        //选中行的记录数    p_selectIds字符串以“,”为分隔符
        int count = StringUtils.countMatches(p_selectIds, ",");


        for (int i=0;i<count;i++)
        {
            String p_selectIds_singal = p_selectIds.substring(0, p_selectIds.indexOf(","));
            selectIdsArray.add(p_selectIds_singal);
            p_selectIds = p_selectIds.substring(p_selectIds.indexOf(",")+1);
        }


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。