java.lang.Character.isSupplementaryCodePoint(int codePoint) es un método incorporado en Java que determina si el carácter especificado (punto de código Unicode) está en el rango de caracteres complementarios.
Sintaxis:
public static boolean isSupplementaryCodePoint(int codePoint)
Parámetros: El codePoint de tipo entero se refiere al carácter (punto de código Unicode) que se va a probar.
Valor de retorno: este método devuelve verdadero si el punto de código especificado se encuentra entre MIN_SUPPLEMENTARY_CODE_POINT y MAX_CODE_POINT inclusive; de lo contrario, es falso.
Los siguientes programas ilustran el método Character.isSupplementaryCodePoint():
Programa 1:
// Code to illustrate the isSupplementaryCodePoint() method import java.lang.*; public class gfg { public static void main(String[] args) { // Create 2 int primitives c1, c2 and assign values 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; // Displaying the result System.out.println(str1); System.out.println(str2); } }
c1 represents a supplementary code point is true c2 represents a supplementary code point is true
Programa 2:
// Code to illustrate the isSupplementaryCodePoint() method import java.lang.*; public class gfg { public static void main(String[] args) { // Creates 2 int primitives c1, c2 and assign values 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; // Displaying the result System.out.println(str1); System.out.println(str2); } }
c1 represents a supplementary code point is true c2 represents a supplementary code point is false
Referencia : https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isSupplementaryCodePoint(int)
Publicación traducida automáticamente
Artículo escrito por Twinkl Bajaj y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA