Javatpoint Logo
Javatpoint Logo

Java Character getDirectionality() Method

The getDirectionality(char ch) method of Character class is used to return the property of unicode directionality for the given character. Generally, character directionality calculates the visual ordering of the text. The directionality value of undefined char value is DIRECTIONALITY_UNDEFINED.

Syntax

Parameter

ch: It is the char for which the directionality property is requested.

Return Value

It returns the directionality property of the char value.

Example 1

Test it Now

Output:

The directionality of Q is 0
The directionality of 1 is 3

Example 2

Test it Now

Output:

Enter the first input:D
The Unicode directionality property for the character D is 0
Enter the second input:4
The Unicode directionality property for the character 4 is 3

Example 3

Test it Now

Output:

Directionality of first primitive is 4
Directionality of second primitive is 13

Java Character getDirectionality() Method

The getDirectionality(int codePoint) method of Character class is used to return the unicode directionality property for the given character. Generally, character directionality is used to calculate the visual ordering of the text. The directionality value for undefined char value is DIRECTIONALITY_UNDEFINED.

Syntax

Parameter

The above method requires only one parameter:

codePoint: It is the character(Unicode code point) for which the directionality property is requested.

Return Value

The getDirectionality(int codePoint) method returns the directionality property of the character.

Example 1

Test it Now

Output:

codePoint: 36
Unicode directionality property for the first codePoint is: 5
codePoint: 36
Unicode directionality property for the second codePoint is: 1

Example 2

Test it Now

Output:

Directionality for first codePoint is 0
Directionality of second codePoint is 13

Example 3

Test it Now

Output:

codePoint: 36
Unicode directionality property for the first codePoint is: 5
codePoint: 2001
Unicode directionality property for the second codePoint is: 1
codePoint: 0
Unicode directionality property for the second codePoint is: 9
Next TopicJava Character



Please Share

facebook twitter google plus pinterest