性格Java中的isSupplementaryCodePoint()方法

这个 JAVA朗,性格。isSupplementaryCodePoint(int代码点) 是java中的内置方法,用于确定指定的字符(Unicode代码点)是否在补充字符范围内。

null

语法:

public static boolean isSupplementaryCodePoint(int codePoint)

参数: 这个 代码点 整型字符是指要测试的字符(Unicode代码点)。

返回值: 如果指定的代码点介于最小值和最大值之间,则此方法返回true,否则返回false。

下面的程序说明了这个角色。isSupplementaryCodePoint()方法:

项目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

项目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

参考 : https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isSupplementaryCodePoint(国际)

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享