可以通过String类的getBytes方法返回字节流,通过字节流判断即可

解决方案 »

  1.   

    不行吧?范围?这是我的测试结果,好几个32的。
    Hello World!中文测试!  朱榕基总理访美专题
    test.charAt(0) is :H   testByte[0] is : 72
    test.charAt(1) is :e   testByte[1] is : 101
    test.charAt(2) is :l   testByte[2] is : 108
    test.charAt(3) is :l   testByte[3] is : 108
    test.charAt(4) is :o   testByte[4] is : 111
    test.charAt(5) is :    testByte[5] is : 32
    test.charAt(6) is :W   testByte[6] is : 87
    test.charAt(7) is :o   testByte[7] is : 111
    test.charAt(8) is :r   testByte[8] is : 114
    test.charAt(9) is :l   testByte[9] is : 108
    test.charAt(10) is :d   testByte[10] is : 100
    test.charAt(11) is :!   testByte[11] is : 33
    test.charAt(12) is :中   testByte[12] is : -42
    test.charAt(13) is :文   testByte[13] is : -48
    test.charAt(14) is :测   testByte[14] is : -50
    test.charAt(15) is :试   testByte[15] is : -60
    test.charAt(16) is :!   testByte[16] is : -78
    test.charAt(17) is :    testByte[17] is : -30
    test.charAt(18) is :    testByte[18] is : -54
    test.charAt(19) is :朱   testByte[19] is : -44
    test.charAt(20) is :榕   testByte[20] is : -93
    test.charAt(21) is :基   testByte[21] is : -95
    test.charAt(22) is :总   testByte[22] is : 32
    test.charAt(23) is :理   testByte[23] is : 32
    test.charAt(24) is :访   testByte[24] is : -42
    test.charAt(25) is :美   testByte[25] is : -20
    test.charAt(26) is :专   testByte[26] is : -23
    test.charAt(27) is :题   testByte[27] is : -59
    test.charAt(28) is :    testByte[28] is : -69Press any key to continue...
      

  2.   

    我不是要转化,只是判断。不想调用strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
    之类的方法。中文unicode编码有个范围吧?我想根据这个范围应该能反过来确定字符是否是中文。
      

  3.   

    搞定了,其实很简单。
    public class TestChinese 
    {
    public static void main(String[] args) 
    {
    String test = "Hello World!中文测试!  朱榕基总理访美专题";
    System.out.println(test);
    for(int i=0;i<test.length();i++){
    System.out.println("test.charAt("+i+") is :"+test.charAt(i));
    if(test.charAt(i)>127)
    System.out.println("中文!");
    else
    System.out.println("English!");
    }
    }
    }
    多谢各位,结贴!