The Character.isMirrored(int codePoint) is an inbuilt method in java that 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. For example, ‘\u0028’ LEFT PARENTHESIS is semantically defined to be an opening parenthesis. This will appear as a “(” in text that is left-to-right but as a “)” in text that is right-to-left.
Syntax:
public static boolean isMirrored(int codePoint)
Parameters: The parameter codePoint of integer type is the character (Unicode code point) to be tested.
Return Value: This method returns true if the character is mirrored, false if the character is not mirrored or is not defined.
Below programs illustrates the Character.isMirrored() method:
Program 1:
// Code to illustrate the isMirrored() method import java.lang.*; public class gfg { public static void main(String[] args) { // Creating 2 int primitives char1, char2 int char1 = 0x0c05 , char2 = 0x013c ; // Checks if character is mirrored or not and prints boolean bool1 = Character.isMirrored(char1); String str1 = "char1 represents a mirrored character is " + bool1; System.out.println(str1); boolean bool2 = Character.isMirrored(char2); String str2 = "char2 represents a mirrored character is " + bool2; System.out.println(str2); } } |
char1 represents a mirrored character is false char2 represents a mirrored character is false
Program 2:
// Code to illustrate the isMirrored() method import java.lang.*; public class gfg { public static void main(String[] args) { // Create 2 int primitives c1, c2 int c1 = 0x0c07 , c2 = 0x063c ; // Checks if character is mirrored or not and prints boolean bool1 = Character.isMirrored(c1); String str1 = "c1 represents a mirrored character is " + bool1; System.out.println(str1); boolean bool2 = Character.isMirrored(c2); String str2 = "c2 represents a mirrored character is " + bool2; System.out.println(str2); } } |
c1 represents a mirrored character is false c2 represents a mirrored character is false
Reference:https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isMirrored(int)