java.lang.Character.isSupplementaryCodePoint(int codePoint)是java中的內置方法,用於確定指定字符(Unicode代碼點)是否在補充字符範圍內。
用法:
public static boolean isSupplementaryCodePoint(int codePoint)
參數:整數類型的codePoint是指要測試的字符(Unicode代碼點)。
返回值:如果指定的代碼點在MIN_SUPPLEMENTARY_CODE_POINT和MAX_CODE_POINT(含)之間,則此方法返回true,否則返回false。
以下示例程序旨在說明Character.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(int)
相關用法
- Java Java lang.Long.numberOfLeadingZeros()用法及代碼示例
- Java Java.util.Collections.rotate()用法及代碼示例
- Java Java lang.Long.highestOneBit()用法及代碼示例
- Java Java lang.Long.byteValue()用法及代碼示例
- Java Java lang.Long.numberOfTrailingZeros()用法及代碼示例
- Java Java lang.Long.lowestOneBit()用法及代碼示例
- Java Java lang.Long.reverse()用法及代碼示例
- Java Java lang.Long.builtcount()用法及代碼示例
- Java Java.util.Collections.disjoint()用法及代碼示例
- Java Java.math.BigInteger.modInverse()用法及代碼示例
- Java Clock tickMinutes()用法及代碼示例
- Java Java.math.BigInteger.probablePrime()用法及代碼示例
- Java Java.util.ArrayList.addall()用法及代碼示例
注:本文由純淨天空篩選整理自Twinkl Bajaj大神的英文原創作品 Character.isSupplementaryCodePoint() Method in Java。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。