LAST UPDATED: NOVEMBER 24, 2020
Java Character isIdentifierIgnorable(int codePoint) Method
Java isIdentifierIgnorable(int codePoint)
method is a part of Character
class. This method is used to check whether the specified Unicode codepoint character can be considered as an ignorable character in Java or a Unicode identifier or not.
The characters which are considered as ignorable characters or Unicode identifier are:
- ISO control characters that are not whitespace.
'\u0000'
through '\u0008'
'\u000E'
through '\u001B'
'\u007F'
through '\u009F'
- all characters that have the
FORMAT
general category value.
Syntax:
public static boolean isIdentifierIgnorable(int codePoint)
Parameters:
The parameter passed is the Unicode codepoint character to be checked for the ignorable character.
Returns:
Returns the boolean value true
if the specified Unicode codepoint character is an ignorable character else return false
.
Example 1:
Here, the characters are checked whether they are ignorable characters or not.
public class StudyTonight
{
public static void main(String[] args)
{
int cp1 = 0x008f;
int cp2 = 0x004f;
int cp3 = 50;
int cp4 = 83;
int cp5 = 55;
boolean b1 = Character.isIdentifierIgnorable(cp1);
boolean b2 = Character.isIdentifierIgnorable(cp2);
boolean b3 = Character.isIdentifierIgnorable(cp3);
boolean b4 = Character.isIdentifierIgnorable(cp4);
boolean b5 = Character.isIdentifierIgnorable(cp5);
System.out.println((char)cp1 +" is a ignorable?: "+b1);
System.out.println((char)cp2 +" is a ignorable?: "+b2);
System.out.println((char)cp3 +" is a ignorable?: "+b3);
System.out.println((char)cp4 +" is a ignorable? : "+b4);
System.out.println((char)cp5 +" is a ignorable?: "+b5);
}
}
is a ignorable?: true
O is a ignorable?: false
2 is a ignorable?: false
S is a ignorable? : false
7 is a ignorable?: false
Example 2:
Here is a user-defined example where anyone using this code can put a value of his choice and get the equivalent output.
import java.util.Scanner;
public class StudyTonight
{
public static void main(String[] args)
{
try
{
System.out.print("Enter the codepoint: ");
Scanner sc = new Scanner(System.in);
int cp = sc.nextInt();
boolean b = Character.isIdentifierIgnorable(cp);
System.out.println((char)cp + " is a ignorable? : "+b);
}
catch(Exception e)
{
System.out.println("Invalid Input!!");
}
}
}
Enter the codepoint: 787
? is a ignorable? : false
*******************************
Enter the codepoint: 0x565
Invalid Input!!
Live Example:
Here, you can test the live code example. You can execute the example for different values, even can edit and write your examples to test the Java code.