简体   繁体   中英

How to convert Unicode to char

I would like to get the Unicode character corresponding to the input int. You can assume that input int can be represented as char in Java.

Character.toString( codePoint )

I would like to get the unicode character corresponding to the input int

String character = Character.toString( codePoint ) ;

You can assume that input int can be represented as char in java.

No, you cannot assume that.

Most of the over 140,000 characters defined in Unicode , and supported by Java, cannot be represented by the char type. As a 16-bit value, a char is physically incapable.

The char type has been legacy since Java 2, basically broken, with code point support added in Java 5+.

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