|
|
参见;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); |
|