liuzidong 发表于 2013-1-27 12:52:25

字符串中取汉字

参见;simplate.net
System.out.println("中国abcdefg123456799".replaceAll("[^\u4E00-\u9FA5]", ""));         System.out.println("中国abcdefg123456799".replaceAll("[\\w]", "").replaceAll("\\p{Punct}", ""));                  String str = "http:中国//baidu.com";         StringBuffer sb = new StringBuffer();         for (int i = 0; i < str.length(); i++) {             if ((str.charAt(i)+"").getBytes().length>1) {                              sb.append(str.charAt(i));             }         }         System.out.println(sb);
页: [1]
查看完整版本: 字符串中取汉字