VOOZH about

URL: https://www.geeksforgeeks.org/java/character-isidentifierignorable-in-java-with-examples/

⇱ Character.isIdentifierIgnorable() in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Character.isIdentifierIgnorable() in Java with Examples

Last Updated : 6 Dec, 2018
  1. The java.lang.Character.isIdentifierIgnorable(char ch) is an inbuilt method in java that determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier. The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:
    • ISO control characters that are not whitespace
      1. '\u0000' through '\u0008'
      2. '\u000E' through '\u001B'
      3. '\u007F' through '\u009F'
    • all characters that have the FORMAT general category value
    Syntax:
    public static boolean isIdentifierIgnorable(char ch)
    Parameters: The parameter ch is of character datatype and refers to the character that is to be tested. Return Value: This method returns true if the character is an ignorable control character that may be part of a Java or Unicode identifier, false otherwise. Below programs illustrate the Character.isIdentifierIgnorable(char ch) method: Program 1:
    Output:
    c1 is an ignorable control character is true
    c2 is an ignorable control character is false
    
    Program 2:
    Output:
    c1 is an ignorable control character is true
    c2 is an ignorable control character is false
    
  2. The java.lang.Character.isIdentifierIgnorable(int codePoint) is similar to the previous method in all manner. Syntax:
    public static boolean isIdentifierIgnorable(int codePoint)
    
    Parameter: The function accepts a single parameter codePoint of integer datatype which specifies the character (Unicode code point) that is to be tested. Return value: This method returns true if the character is an ignorable control character that may be part of a Java or Unicode identifier, false otherwise. Below program illustrates the Character.isIdentifierIgnorable(int codepoint) method: Program 1:
    Output:
    c1 is an ignorable control character? ans is false
    c2 is an ignorable control character? ans is false
    
    Program 2:
Output:
c1 is an ignorable control character? ans is false
c2 is an ignorable control character? ans is false
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isIdentifierIgnorable(char)
Comment