08-08
28
格式转换
作者:Java伴侣 日期:2008-08-28
复制内容到剪贴板 程序代码
String tagid = "{8}{15}{16}{20}{22}{25}";
List<Integer> lst = new ArrayList<Integer>();
Pattern p = Pattern.compile("\\{(\\d+)\\}");
Matcher m = p.matcher(tagid);
while (m.find()) {
lst.add(Integer.parseInt(m.group(1)));
}
for (int num : lst) {
System.out.println(num);
}
List<Integer> lst = new ArrayList<Integer>();
Pattern p = Pattern.compile("\\{(\\d+)\\}");
Matcher m = p.matcher(tagid);
while (m.find()) {
lst.add(Integer.parseInt(m.group(1)));
}
for (int num : lst) {
System.out.println(num);
}
评论: 0 | 引用: 0 | 查看次数: 430
发表评论