java中判断字符串中是否有中文字符

package com.meritit.test;

public class TestChart {
	 public static void main(String[] args) throws Exception {
	        String aa = "中国China人";
	        for (int i = 0; i < aa.length(); i++) {
	            String bb = aa.substring(i, i + 1);
	            boolean cc = java.util.regex.Pattern.matches("[\u4E00-\u9FA5]", bb);
	            if (cc) {
	                System.out.println(bb);
	            }
	        }
	 }
}



posted on 2013-08-09 12:57  岚之山  阅读(264)  评论(0编辑  收藏  举报

导航