Character.isMirrored(): 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.isMirrored(char ch)
This method takes one argument of type char as its parameter. This method determines whether the character is mirrored according to the Unicode specification. Mirrored characters should have their glyphs horizontally mirrored when displayed in text that is right-to-left.
Parameters: One parameter is required for this method.
ch: char for which the mirrored property is requested.
Returns: true if the char is mirrored, false if the char is not mirrored or is not defined.
Exceptions: NA
Java
public class CharacterisMirroredchar {public static void main(String[] args) {char ch = '(';System.out.println(Character.isMirrored(ch));}}
Output:
true
Approach 2: When the argument is of type int.
Syntax:
boolean java.lang.Character.isMirrored(int codePoint)
This method takes one argument of type int as its parameter. This method determines whether the specified character (Unicode code point)is mirrored according to the Unicode specification. Mirrored characters should have their glyphs horizontally mirrored when displayed in text that is right-to-left.
Parameters: One parameter is required for this method.
codePoint: the character (Unicode code point) to be tested.
Returns: true if the character is mirrored, false if the character is not mirrored or is not defined.
Exceptions: NA
Java
public class CharacterisMirroredint {public static void main(String[] args) {int codePoint = 'M';System.out.println(Character.isMirrored(codePoint));}}
Output:
No comments:
Post a Comment