public boolean hasFullChar(String str) {
        if (str.getBytes().length == str.length()) {
            return false;
        } 
        return true;    
    }
中文字符属于全角。

解决方案 »

  1.   

    ascii码大于128得都可以作为中文吧,
      

  2.   

    “中文字符是全角字符”,但全角字符不一定都是中文。
    所以,如果要精确判断是否为中文字符,应该用unicode编码数值来判断。
      

  3.   

    那如何知道中文在Unicode中的编码区间呢?
      

  4.   

    if(s1.matches("[\\u4E00-\\u9FA5]+")) 
    System.out.println("contain chinese");
      

  5.   

    if(s1.matches("[\\u4E00-\\u9FA5]+")) 
    System.out.println("contain chinese");
    如果s1只包含汉字,则打印contain chinese 
    如果s1既有汉字又有英文字母,则不会打印contain chinese ?
    我想s1中只要包含汉字,就打印contain chinese,如何做呢?
      

  6.   

    如果s1 = "中国chinese",则不会打印contain chinese
      

  7.   

    hehe, oldbluesea(bigseal) 已经说清楚了,少改改即可如下:String str = "中国chinese";
    for(int i =0 ;i < str.length() ; i ++)
    {
    System.out.println(str.substring(i, i+1).matches("[\\u4e00-\\u9fa5]+"));
    }这样既可以次判断每个字符……