本文共 2306 字,大约阅读时间需要 7 分钟。
of() method is available in java.lang package.
of()方法在java.lang包中可用。
of() method is used to return the Unicode block containing the given parameter value or it returns null when the given char value is not a part of a defined Unicode Block.
of()方法用于返回包含给定参数值的Unicode块,或者在给定char值不属于已定义Unicode块的一部分时返回null。
of() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get any error.
of()方法是一个静态方法,可以使用类名进行访问,如果尝试使用类对象访问该方法,则不会出现任何错误。
of() method does not throw an exception at the time of returning Unicode block.
of()方法在返回Unicode块时不会引发异常。
Syntax:
句法:
public static Character.UnicodeBlock of(Char value);
Parameter(s):
参数:
Char value – represents the character value.
字符值 –表示字符值。
Return value:
返回值:
The return type of this method is Character.UnicodeBlock, it returns the following values based on the given cases,
此方法的返回类型为Character.UnicodeBlock ,它基于给定的情况返回以下值,
It returns the Unicode Block when the given char value is a part of any defined Unicode block.
当给定的char值是任何已定义的Unicode块的一部分时,它将返回Unicode块。
It returns null when the given char value is not a part of any defined Unicode code block.
当给定的char值不属于任何已定义的Unicode代码块时,它返回null。
Example:
例:
// Java program to demonstrate the example // of Character.UnicodeBlock of(Char value)// method of Character.UnicodeBlock classpublic class Of { public static void main(String args[]) { // By using of(Char ch) method is to return the UnicodeBlock name // containing the given char value Character.UnicodeBlock ub1 = Character.UnicodeBlock.of('+'); Character.UnicodeBlock ub2 = Character.UnicodeBlock.of('u'); Character.UnicodeBlock ub3 = Character.UnicodeBlock.of('/'); Character.UnicodeBlock ub4 = Character.UnicodeBlock.of('a'); Character.UnicodeBlock ub5 = Character.UnicodeBlock.of('A'); // Display UnicodeBlock name System.out.println("ub1 = " + ub1); System.out.println("ub2 = " + ub2); System.out.println("ub3 = " + ub3); System.out.println("ub4 = " + ub4); System.out.println("ub5 = " + ub5); }}
Output
输出量
ub1 = BASIC_LATINub2 = BASIC_LATINub3 = BASIC_LATINub4 = BASIC_LATINub5 = BASIC_LATIN
翻译自:
转载地址:http://zsxzd.baihongyu.com/