Java:转换字符串“\ uFFFF”"成为char [英] Java: Convert String "\uFFFF" into char
本文介绍了Java:转换字符串“\ uFFFF”"成为char的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种标准方法将字符串转换为\ uFFFF字符,这意味着六个字符的字符串包含一个unicode字符的表示形式?
Is there a standard method to convert a string like "\uFFFF" into character meaning that the string of six character contains a presentation of one unicode character?
推荐答案
char c = "\uFFFF".toCharArray()[0];
该值直接解释为所需的字符串,整个序列实现为单个字符。
The value is directly interpreted as the desired string, and the whole sequence is realized as a single character.
另一种方法,如果您要对该值进行硬编码:
Another way, if you are going to hard-code the value:
char c = '\uFFFF';
请注意 \ uFFFF
不会似乎是一个合适的unicode角色,但尝试使用 \\\ u040f
。
Note that \uFFFF
doesn't seem to be a proper unicode character, but try with \u041f
for example.
这篇关于Java:转换字符串“\ uFFFF”"成为char的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文