相关疑难解决方法(0)

将char与代码点进行比较?

将代码点与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方法codepointschars,或转换char到一个codepoint比较?

java unicode

34
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×1

unicode ×1