简体   繁体   中英

print out the whole Chinese dictionary with output { unicode, Chinese character)

Would some one show me how to print out the whole Chinese dictionary with output { unicode, Chinese character) in Java ?

String index = String.valueOf(i) ;
String chineseChar = "\\" + "u4e0" + index ;
System.out.println (index + " => " + chineseChar );

Last statement printed out 0 => \一 The problem was the right hand side should have been a chinese character "One".

What is exactly the range of Chinese encoding in unicode ?

Just use Integer addition

String index = String.valueOf(i) ;
int chineseChar = '\u4e00' + i;
System.out.println (index + " => " + (char)chineseChar );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM