Character.getDirectionality(): This method is available in java.lang.Character class of Java.
Approach 1: When the argument of type char.
Syntax:
byte java.lang.Character.getDirectionality(char ch)
This method takes one argument of type char as its parameter. This method returns the Unicode directionality property for the given character. Character directionality is used to calculate the visual ordering of text.
Parameters: One parameter is required for this method.
ch: char for which the directionality property is requested.
Returns: the directionality property of the char value.
Exceptions: NA
Java
public class CharactergetDirectionality {public static void main(String[] args) {char ch = '@';System.out.println(Character.getDirectionality(ch));}}
Output:
13
Approach 2: When the argument of type int.
Syntax:
byte java.lang.Character.getDirectionality(int codePoint)
This method takes one argument of type int as its parameter. This method returns the Unicode directionality property for the given character (Unicode code point).
Parameters: One parameter is required for this method.
codePoint: the character (Unicode code point) for which the directionality property is requested.
Returns: the directionality property of the character.
Exceptions: NA
Java
public class CharactergetDirectionalityint {public static void main(String[] args) {int codePoint = '#';System.out.println(Character.getDirectionality(codePoint));}}
Output:
5
No comments:
Post a Comment