如何编写一个Java函数来返回Unicode点的标准名称? [英] How can I write a Java function to return the standard name for a Unicode point?
问题描述
我想写一个函数
String getName(int codePoint) {
// ????
}
这将返回给定代码点表示的字符的标准名称。例如
which will return the standard name given to the character that the given code point represents. For example
getName(0);
会返回StringNULL和
would return the String "NULL" and
getName(33);
会返回字符串EXCLAMATION POINT。
would return the String "EXCLAMATION POINT".
这是JDK中有什么东西吗?
Is there anything in the JDK for this?
推荐答案
unicode标准是一个文件 UnicodeData-< Version> .txt (从unicode.org下载不工作),包含名称(和读取方向,toLowerCase和toUpperCase等) ):
Part of the unicode standard is a file UnicodeData-<Version>.txt (the download from unicode.org does not work) that contains the name (and reading direction, toLowerCase and toUpperCase etc.):
0021;EXCLAMATION MARK;Po;0;ON;;;;;N;;;;;
因此 0x21
被unicode标准称为
这可能被埋在JRE的某个地方,因为它用于转换小写和大写字符。
This could be buried somewhere in the JRE in some form as it is used to convert to lower and upper case characters.
这篇关于如何编写一个Java函数来返回Unicode点的标准名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!