Character.isISOControl() method with examples in Java - GeeksforGeeks

06 Dec, 2018
The java.lang.Character.isISOControl() is an inbuilt method in java which determines if the specified character is an ISO control character or not. A character is considered to be an ISO control character if its code is in the range ‘\u0000’ through ‘\u001F’ or in the range ‘\u007F’ through ‘\u009F’. This method cannot handle supplementary characters. In order to support all the Unicode characters, including supplementary characters, the parameter can be on int datatype in the above method.
Syntax:
public static boolean isISOControl(data_type ch)

Parameters: The function accepts a single parameter ch which is mandatory. It specifies the character to be tested. The parameter can be of char or int datatype.
Return value: The function returns a boolean value. The boolean value is true if the character is an ISO control character or false otherwise.
Below programs illustrate the above method:
Program 1:
// java program to demonstrate// Character.isISOControl() method// when the parameter is a character  import java.lang.*;  public class gfg {      public static void main(String[] args)    {          // create 2 char primitives c1, c2 and assign values        char c1 = '-', c2 = '\u0017';          // assign isISOControl results of c1        // to boolean primitives  bool1        boolean bool1 = Character.isISOControl(c1);          if (bool1)            System.out.println(c1 + " is an ISO control character");        else            System.out.println(c1 + " is not an ISO control character");          // assign isISOControl results of c2        // to boolean primitives  bool2        boolean bool2 = Character.isISOControl(c2);          if (bool2)            System.out.println(c2 + " is an ISO control character");        else            System.out.println(c2 + " is not an ISO control character");    }}
- is not an ISO control character
u0017 is an ISO control character

Program 2:
// java program to demonstrate// Character.isISOControl(char ch) method// when the parameter is an integerimport java.lang.*;  public class gfg {      public static void main(String[] args)    {          // create 2 char primitives c1, c2 and assign values        int c1 = 0x008f;        int c2 = 0x0123;          // assign isISOControl results of c1        // to boolean primitives  bool1        boolean bool1 = Character.isISOControl(c1);        if (bool1)            System.out.println(c1 + " is an ISO control character");        else            System.out.println(c1 + " is not an ISO control character");          // assign isISOControl results of c2        // to boolean primitives  bool2        boolean bool2 = Character.isISOControl(c2);        if (bool2)            System.out.println(c2 + " is an ISO control character");        else            System.out.println(c2 + " is not an ISO control character");    }}
143 is an ISO control character
291 is not an ISO control character

Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isISOControl(char)
Java-Character
Java-Functions
Java-lang package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Different ways of Reading a text file in Java
Constructors in Java
Stream In Java
Exceptions in Java
Generics in Java
Comparator Interface in Java with Examples
StringBuilder Class in Java with Examples
HashMap get() Method in Java
Functional Interfaces in Java
Strings in Java