Character.isMirrored() method in Java
Last Updated :
06 Dec, 2018
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:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
int char1 = 0x0c05 , char2 = 0x013c ;
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);
}
}
|
Output:
char1 represents a mirrored character is false
char2 represents a mirrored character is false
Program 2:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
int c1 = 0x0c07 , c2 = 0x063c ;
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);
}
}
|
Output:
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)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...