getNumericValue:
public static int getNumericValue(char ch)
Returns the Unicode numeric value of the character as a nonnegative integer. If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.
Parameters:
ch - the character to be converted.
Returns:
the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value that is not a nonnegative integer; -1 if the character has no numeric value.
//---------------------------------------------------------
我想只有这种方法了
再去查一下中文的 Unicode 的范围

解决方案 »

  1.   

    如果不需要很精确
    char字符<256的就是英文字母或者符号
    以上的就不是字母了,可能是中文和其他字符
      

  2.   

    只要比较一下ASCII码就可以了吧
      

  3.   

    我已解决。代码如下:
      
      public static final String chopString(String string, int length) { String rc=null;
    try{
    byte[] bs = string.getBytes();
    byte[] newBytes = new byte[length];
    System.arraycopy(bs,0,newBytes,0,length -1);
    rc = new String(newBytes, "GB2312");
    }catch(java.io.UnsupportedEncodingException e){
    System.out.println(e.getMessage());
    }
    // throw away the last char
    return rc.substring(0,rc.length() -1);
    }