从一个字符串中提取中文字符

来源:互联网 发布:张靓颖乳钉 知乎 编辑:程序博客网 时间:2024/05/16 11:17
String str = "http:我骄傲叫大姐阿卡是假的 //music.douban.我是的你的进啊进空间啊com/subject/1455613/";  Pattern p = null;  Matcher m = null;  String value = null;  p = Pattern.compile("([\u4e00-\u9fa5]+)");  m = p.matcher(str);  while(m.find())  {   System.out.println(m.group());  }//  if(m.find())//  {// //  value = m.group();//  String china = URLEncoder.encode(value,"UTF-8");//  String url = str.replace(value, china);//  System.out.println(url);//  }    }


 

 

原创粉丝点击