Character.isSupplementaryCodePoint() Method in Java
Last Updated :
06 Dec, 2018
The java.lang.Character.isSupplementaryCodePoint(int codePoint) is an inbuilt method in java that determines whether the specified character (Unicode code point) is in the supplementary character range.
Syntax:
public static boolean isSupplementaryCodePoint(int codePoint)
Parameters: The codePoint of integer type refers to the character (Unicode code point) that is to be tested.
Return Value: This method returns true if the specified code point is between MIN_SUPPLEMENTARY_CODE_POINT and MAX_CODE_POINT inclusive, false otherwise.
Below programs illustrate the Character.isSupplementaryCodePoint() method:
Program 1:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
int c1 = 0x10ffd , c2 = 0x154ca ;
boolean bool1 = Character.isSupplementaryCodePoint(c1);
boolean bool2 = Character.isSupplementaryCodePoint(c2);
String str1 = "c1 represents a supplementary code point is " + bool1;
String str2 = "c2 represents a supplementary code point is " + bool2;
System.out.println(str1);
System.out.println(str2);
}
}
|
Output:
c1 represents a supplementary code point is true
c2 represents a supplementary code point is true
Program 2:
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
int c1 = 0x45ffd , c2 = 0x004ca ;
boolean bool1 = Character.isSupplementaryCodePoint(c1);
boolean bool2 = Character.isSupplementaryCodePoint(c2);
String str1 = "c1 represents a supplementary code point is " + bool1;
String str2 = "c2 represents a supplementary code point is " + bool2;
System.out.println(str1);
System.out.println(str2);
}
}
|
Output:
c1 represents a supplementary code point is true
c2 represents a supplementary code point is false
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isSupplementaryCodePoint(int)
Share your thoughts in the comments
Please Login to comment...