Character.isUnicodeIdentifierPart() in Java

Character.isUnicodeIdentifierPart(): This method is available in java.lang.Character class of Java.

Approach 1: When the argument is of type char.

Syntax:

boolean java.lang.Character.isUnicodeIdentifierPart(char ch)

This method takes one argument of type char as its parameter. This method determines if the specified character may be part of a Unicode identifier other than the first character.

Parameters: One parameter is required for this method.

ch: the character to be tested.

Returns: true if the character may be part of a Unicode identifier; false otherwise.

Exceptions: NA

Java

public class CharacterisUnicodeIdentifierPartchar {
    public static void main(String[] args) {

        char ch = 'a';
        System.out.println(Character.isUnicodeIdentifierPart(ch));
    }
}

Output:

true


Approach 2: When the argument is of type int.

Syntax:

boolean java.lang.Character.isUnicodeIdentifierPart(int codePoint)

This method takes one argument of type int as its parameter. This method determines if the specified character (Unicode code point) may be part of a Unicode identifier as other than the first character.

Parameters: One parameter is required for this method.

codePoint: the character (Unicode code point) to be tested.

Returns: true if the character may be part of a Unicode identifier; false otherwise.

Exceptions: NA

Java

public class CharacterisUnicodeIdentifierPartint {
    public static void main(String[] args) {

        int codePoint = 'a';
        System.out.println(Character.isUnicodeIdentifierPart(codePoint));
    }
}

Output:

true

No comments:

Post a Comment