现在的位置: 首页 > 综合 > 正文

用符合分割字符串

2013年01月29日 ⁄ 综合 ⁄ 共 284字 ⁄ 字号 评论关闭
 String time = "english;'''abc; a ;中国;";
          String regex = "[^(//p{Blank}//p{Punct})]+";
          Pattern p = Pattern.compile(regex);
          Matcher matcher = p.matcher(time);
          while(matcher.find()){
              System.out.println(matcher.group());
          }

结果 
      english
      abc
      a
      中国   

抱歉!评论已关闭.