可以通过String类的getBytes方法返回字节流,通过字节流判断即可
解决方案 »
- Lucene 3.0 原理与代码分析
- foreach循环在没有元素的情况下,不进入循环?
- 关于 打包 打问题
- 关于梦幻西游走路问题
- 使用属性方法访问的速度比直接使用属性操作还快?
- ---如何用正则表达式不区分大小写的匹配特定的单词-----
- 发送InstallAnywhere 6 Enterprise 注册号
- 请问会使用PropertyChangeListener这个接口,谢谢,给分!
- 求大神改改代码,小弟实在没有办法了,就是N个人站一圈,报数从1开始报到3的人退出。答案看过了,但是不清楚自己的哪里错了,求批改
- FileReader可以用来读文本文件吗
- 大家合作开发国产的项目管理软件——关注及UP者有分,参与者源码相送。(1)
- 关于JSP的BEANS的问题。各位请进!
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...
之类的方法。中文unicode编码有个范围吧?我想根据这个范围应该能反过来确定字符是否是中文。
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!");
}
}
}
多谢各位,结贴!