Java Character getName() 方法

2024年12月12日 | 阅读 2 分钟

getName(int codePoint) 方法返回指定字符的 Unicode 名称,如果 codePoint 未分配,则返回 null。如果 Unicode 数据文件未为指定字符分配名称,则返回的名称与表达式的结果相同。

语法

参数

上述方法只需要一个参数

codePoint:它是字符 (Unicode code point)

返回值

字符,如果 codePoint 未分配,则返回 null。

示例 1

输出

The first character ' ' has the Unicode name as: NULL 

示例 2

输出

The character ']' has the unicode name as: RIGHT SQUARE BRACKET
The character 'E' has the unicode name as: LATIN CAPITAL LETTER E

示例 3

输出

The first character 'P' has the unicode name as: LATIN CAPITAL LETTER P
The second character '7' has the unicode name as: DIGIT SEVEN
The third character 'n' has the unicode name as: LATIN SMALL LETTER N
The fourth character '?' has the unicode name as: COMBINING CARON

下一主题Java Currency