开发者

What's the Unicode code point for [ \u8D27 ]?

开发者 https://www.devze.com 2023-01-03 14:10 出处:网络
I want to find out if a Chinese character can be displayed, the unidode for it is \"\\u8D27\", how to use the Java Font method canDisplay ? It takes an int, but \"8D27\" is not an integer开发者_如何学

I want to find out if a Chinese character can be displayed, the unidode for it is "\u8D27", how to use the Java Font method canDisplay ? It takes an int, but "8D27" is not an integer开发者_如何学Python, how does it work, do I need another method to translate "8D27" to an int then use canDisplay ? If so how to translate it ?

Edit : To be more precise, how would a method below look like ?

boolean checkFonts(String inputUnicode)
{
  ... what goes here ??? ...
}

So if I call : checkFonts("\u8D27") , I can get a yes no answer.

Frank


8D27 is in hex, so you can write 0x8D27 as a literal.

e.g.

private int codePoint = 0x8D27;

The \uXXXX syntax represents the character itself at that code point and is used such that you can express Unicode characters in ASCII.


The canDisplay() method also accepts a char, so why not just get the first character of the string:

return font.canDisplay(inputUnicode.charAt(0));

And FWIW, you can convert between char and int just by casting:

int codePoint = 0x8D27;
char myCharacter = (char) codePoint;
0

精彩评论

暂无评论...
验证码 换一张
取 消