java.lang.Character isISOControl(int codePoint)

Description

The Character.isISOControl(int codePoint) java method determines if the referenced character (Unicode code point) is an ISO control character. 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’.

The isISOControl(int codePoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Character.isISOControl(int codePoint)

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java isISOControl() method non statically.

Method Syntax

public static boolean isISOControl(int codePoint)

Method Argument

Data Type Parameter Description
int codepoint the character (Unicode code point) to be tested.

Method Returns

The isISOControl(int codePoint) method of Character class returns true if the character is an ISO control character; false otherwise.

Compatibility

Requires Java 1.5 and up

Java Character isISOControl(int codePoint) Example

Below is a simple java example on the usage of isISOControl(int codePoint) method of Character class.

package com.javatutorialhq.java.examples;

import java.util.Scanner;

/*
 * This example source code demonstrates the use of 
 * isISOControl(char ch) method of Character class.
 */

public class CharacterIsISOControlCharExample {

	public static void main(String[] args) {

		// Ask for user input
		System.out.print("Enter an input:");

		// use scanner to get the user input
		Scanner s = new Scanner(System.in);

		// gets the user input
		char[] value = s.nextLine().toCharArray();

		// close the scanner object
		s.close();

		// check if user input is an ISO control character
		for (char ch : value) {
			boolean result = Character.isISOControl(ch);
			// print the result
			if(result){
				System.out.println("character " + ch 
						+ " is an ISO control character? " + result);
			}
			else{
				System.out.println("character " + ch 
						+ " is not an ISO control character? " + result);
			}
			
		}

	}

}

Sample Output

Below is the sample output when you run the above example.

java Character isISOControl(int codePoint) example output