日期:2014-05-19 浏览次数:20613 次
String text = "U#:zhang_san#:ASSIGN#:2#:0#:0#:0#:#:#:#:#;U#:wang_wu#:ASSIGN#:2#:0#:0#:0#:#:#:#:#;"; Matcher m = Pattern.compile("U#:([^#]+)#").matcher(text); StringBuilder sb = new StringBuilder(); while(m.find()){ sb.append(m.group(1)).append(":"); } if(sb.length()>1) sb.deleteCharAt(sb.length()-1); System.out.println(sb.toString());
------解决方案--------------------