Javatpoint Logo
Javatpoint Logo

Java Character isMirrored() Method

The isMirrored(char ch) method of Character class determines whether the given(or specified) character is mirrored as per the Unicode specification. The mirrored characters must have their glyphs horizontally mirrored so that when displayed in the text, they are from right-to-left.

NOTE: The above method cannot be used to handle the supplementary characters. In order to handle the supplementary characters, we can use the isMirrored (int) method.

Syntax

Parameters

ch: It is the character that needs to be tested for the mirror property.

Return Value

The isMirrored(char ch)method returns a Boolean value, i.e., true if the given(or specified) character is mirrored. Otherwise, the method returns false.

Example 1

Output:

Enter the first character:*
The first input '*' is not mirrored.
Enter the second character:[
The second input '[' is mirrored.

Example 2

Test it Now

Output:

The first character '{' is a mirrored character: true
The second character '^' is a mirrored character: false
The third character '&' is a mirrored character: false

Java Character isMirrored () Method

The isMirrored(int codePoint) method of Character class determines whether the given(or specified) character is mirrored as per the Unicode specification.

The mirrored characters must have their glyphs horizontally mirrored so that when displayed in the text, they are from right-to-left.

Syntax

Parameters

codePoint: It is the codePoint which is the character that needs to be tested.

Return Value

The isMirrored(int codePoint)method returns a Boolean value, i.e., true if the given(or specified) character is mirrored. Otherwise, the method returns false.

Example 1

Test it Now

Output:

The first Codepoint '93' is mirrored 
The second codepoint '121' is not mirrored. 
The third codepoint '168' is not mirrored. 
The fourth codepoint '199' is not mirrored.

Example 2

Test it Now

Output:

The first codePoint '3073' represents a mirrored character: false
The second codePoint '60' represents a mirrored character: true
The third codePoint '120' represents a mirrored character: false

Example 3

Output:

Enter the first input:[
The character '[' is mirrored. 
Enter the second input:*
The character '*' is not mirrored.
Enter the third input:}
The character '}' is not mirrored.
Next TopicJava Character




Please Share

facebook twitter google plus pinterest