2012年5月7日

Pattern和matcher

摘要: 下面说一下这两个类的用法:Pattern就是用于构建正则表达式的,正则表达式如果不懂的可以去我的上一篇博文看看.1.构建一个Pattern: static String str = "hello world"; static final Pattern p = Pattern.compile("he");2.写一个方法: View Code 1 public static void find(){ 2 Matcher m = p.matcher(str); 3 if(m.find()){ 4 //找到所需的字符串 5 ... 阅读全文

posted @ 2012-05-07 10:30 saobchj 阅读(202) 评论(0) 推荐(0) 编辑

导航