private List<Integer> getAllIndex(String content,String groupf) { List<Integer> res = new ArrayList<Integer>(); //记录位置 Integer index; //需要匹配的次数 String[] split = content.split(groupf); if(split.length>2){ index = content.indexOf(groupf); res.add(index); for (int i= 0;i<split.length-2 ;i++){ index = content.indexOf(groupf,index+groupf.length()); res.add(index); } }else{ index = content.indexOf(groupf); res.add(index); } return res; }
字符串匹配所有子串坐标
最新推荐文章于 2022-02-21 12:16:31 发布