Java.lang.Character.UnicodeBlock.of(char c) 方法
描述
java.lang.Character.UnicodeBlock.of(char c) 方法返回表示包含给定字符的 Unicode 块的对象,如果该字符不是已定义块的成员,则返回 null。
声明
以下是 java.lang.Character.UnicodeBlock.of() 方法的声明。
public static Character.UnicodeBlock of(char c)
参数
c − 这个是字符。
返回值
此方法返回表示该字符所属的 Unicode 块的 UnicodeBlock 实例,如果该字符不是任何 Unicode 块的成员,则返回 null。
异常
NA
示例
下面的例子展示了 java.lang.Character.UnicodeBlock.of() 方法的使用。
package com.tutorialspoint;
import java.lang.*;
public class CharacterUnicodeBlockDemo {
public static void main(String[] args) {
/* returns the object representing the Unicode block containing
the given character */
System.out.println(Character.UnicodeBlock.of('\u20ac'));
System.out.println(Character.UnicodeBlock.of('-'));
System.out.println(Character.UnicodeBlock.of('='));
System.out.println(Character.UnicodeBlock.of('Z'));
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
CURRENCY_SYMBOLS BASIC_LATIN BASIC_LATIN BASIC_LATIN

