Character.isISOControl() method with examples in Java
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:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
char c1 = '-' , c2 = '\u0017' ;
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" );
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" );
}
}
|
Output:
- is not an ISO control character
is an ISO control character
Program 2:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
int c1 = 0x008f ;
int c2 = 0x0123 ;
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" );
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" );
}
}
|
Output:
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)
Last Updated :
06 Dec, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...