将代码点与Java角色进行比较的"正确"方法是什么?例如:
int codepoint = String.codePointAt(0);
char token = '\n';
Run Code Online (Sandbox Code Playgroud)
我知道我可能会这样做:
if (codepoint==(int) token)
{ ... }
Run Code Online (Sandbox Code Playgroud)
但这段代码看起来很脆弱.有没有比较正式的API方法codepoints来chars,或转换char到一个codepoint比较?