java.lang.Character.isUnicodeIdentifierPart(int codePoint)%uA0确定指定字符(Unicode代码点)可能是Unicode标识符中除首字符以外的部分。
字符可以是Unicode标识符的一部分,当且仅当下列一个语句是正确的:
-
它是一个字母
-
它是一个连接标点字符(如“_”)
-
它是一个数字
-
它是一个数字字母(如罗马数字字符)
-
它是一个组合标志
-
它是一个非空格标记
-
isIdentifierIgnorable此字符返回true。
声明
以下是java.lang.Character.isUnicodeIdentifierPart()方法的声明
public static boolean isUnicodeIdentifierPart(int codePoint)
参数
-
codePoint%uA0- 进行测试的字符(Unicode代码点)
返回值
如果字符可以是Unicode标识符的一部分此方法返回true,否则返回false。
异常
-
NA
例子
下面的例子显示lang.Character.isUnicodeIdentifierPart()方法的使用。
package com.yiibai import java.lang.* public class CharacterDemo { public static void main(String[] args) { // create 2 int primitives cp1, cp2 int cp1, cp2 // assign values to cp1, cp2 cp1 = 0x053e // represents ARMENIAN CAPITAL LETTER CA cp2 = 0x0040 // represents @ // create 2 boolean primitives b1, b2 boolean b1, b2 /** * check if cp1, cp2 may be part of a Unicode identifier * and assign results to b1, b2. */ b1 = Character.isUnicodeIdentifierPart(cp1) b2 = Character.isUnicodeIdentifierPart(cp2) String str1 = "cp1 may be part of a Unicode identifier is " + b1 String str2 = "cp2 may be part of a Unicode identifier is " + b2 // print b1, b2 values System.out.println( str1 ) System.out.println( str2 ) } }
让我们来编译和运行上面的程序,这将产生以下结果:
cp1 may be part of a Unicode identifier is true cp2 may be part of a Unicode identifier is false