Signup/Sign In
LAST UPDATED: NOVEMBER 24, 2020

Java Character isISOControl(int codePoint) Method

Java isISOControl(int codePoint) is a part of Character class. This method is used to check whether the specified Unicode codepoint character is an ISO control character or not.

A character is an ISO control character if its code lies in the range of '\u000' through '\u001F' or in the range of '\u007F' through '\u009F'.

Syntax:

public static boolean isISOControl(int codePoint)

Parameters:

The parameter passed is the Unicode codePoint character to be checked for ISO Control.

Returns:

Returns the boolean value true if the specified Unicode codepoint character is an ISO control character else return false.

Example 1:

Here, the Unicode codepoint characters are checked whether they are ISO Control characters or not.

public class StudyTonight
{  
	public static void main(String[] args)
	{  
		int cp1 = 28;  
		int cp2 = 32;  
		int cp3 = 122;  
		int cp4 = 90;   
		int cp5 = 1232;  

		boolean b1 = Character.isISOControl(cp1);  
		boolean b2 = Character.isISOControl(cp2);  
		boolean b3 = Character.isISOControl(cp3);  
		boolean b4 = Character.isISOControl(cp4);  
		boolean b5 = Character.isISOControl(cp5);  

		System.out.println((char)cp1 +" is a ISO control?:  "+b1);  
		System.out.println((char)cp2 +" is a ISO control?:  "+b2);  
		System.out.println((char)cp3 +" is a ISO control?:  "+b3);  
		System.out.println((char)cp4 +" is a ISO control? : "+b4);  
		System.out.println((char)cp5 +" is a ISO control?:  "+b5);  
	}  
} 


 is a ISO control??: true
is a ISO control??: false
z is a ISO control??: false
Z is a ISO control?? : false
? is a ISO control??: 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 unicode character: ");  
			Scanner sc = new Scanner(System.in);         
			int cp = sc.nextInt();  
			boolean b = Character.isISOControl(cp);
			System.out.println((char)cp + " is an ISO Control? : "+b);
		}
		catch(Exception e)
		{
			System.out.println("Invalid Input!!");
		}
	}  
}  


Enter the unicode character: 29
 is an ISO Control? : true
*************************************
Enter the unicode character: 40
( is an ISO Control? : false

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.



About the author:
A Computer Science and Engineering Graduate(2016-2020) from JSSATE Noida. JAVA is Love. Sincerely Followed Sachin Tendulkar as a child, M S Dhoni as a teenager, and Virat Kohli as an adult.