Character类的isBmpCodePoint(int codePoint()方法一般判断给定(或指定)的Unicode字符是否在Basic Multilingual Plane(BMP)的范围内,这些指定的codePoints可以通过单个char值来表示。
用法
public static Boolean isBmpCodePoint(int codePoint)
参数
上述方法只需要一个参数:
a.)codePoint 是需要测试的 Unicode 字符。
返回值
Character 类的 isBmpCodePoint(int codePoint) 方法返回布尔值,即 true,如果指定的 codePoint 位于 MIN_VALUE 和 MAX_VALUE 的值之间。否则,它返回 false。
例子1
public class JavaCharcterisBmpCodePointExample1 {
public static void main(String[] args) {
char cp1 = ' ';
char cp2 = 'A';
char cp3 = 'B';
char cp4 = 'a';
char cp5 = 'b';
boolean b1 = Character.isBmpCodePoint(cp1);
boolean b2 = Character.isBmpCodePoint(cp2);
boolean b3 = Character.isBmpCodePoint(cp3);
boolean b4 = Character.isBmpCodePoint(cp4);
boolean b5 = Character.isBmpCodePoint(cp5);
System.err.println("The value for the first char comes to be: "+b1);
System.err.println("The value for the second char comes to be:"+b2);
System.err.println("The value for the third char comes to be: "+b3);
System.err.println("The value for the fourth char comes to be:"+b4);
System.err.println("The value for the fifth char comes to be: "
+b5);
}
}
输出:
The value for the first char comes to be: true The value for the second char comes to be:true The value for the third char comes to be: true The value for the fourth char comes to be:true The value for the fifth char comes to be: true
例子2
public class JavaCharcterisBmpCodePointExample2 {
public static void main(String[] args) {
// Initialize the codePoints.
int codepoint1 = 12;
int codepoint2 = 121;
int codepoint3 = 684748;
// Check the codepoints whether they are in Basic Multilingual Plane (BMP).
boolean result1 = Character.isBmpCodePoint(codepoint1);
boolean result2 = Character.isBmpCodePoint(codepoint2);
boolean result3 = Character.isBmpCodePoint(codepoint3);
// Finally print the result.
System.out.println("The boolean value for the first codePoint is given as: "+result1);
System.out.println("The boolean value for the second codePoint is given as: "+result2);
System.out.println("The boolean value for the third codePoint is given as: "+result3);
}
}
输出:
The boolean value for the first codePoint is given as: true The boolean value for the second codePoint is given as: true The boolean value for the third codePoint is given as: false
例子3
public class JavaCharcterisBmpCodePointExample3 {
public static void main(String[] args) {
char cp1 = '1';
char cp2 = '2';
char cp3 = '3';
char cp4 = '4';
char cp5 = '5';
boolean b1 = Character.isBmpCodePoint(cp1);
boolean b2 = Character.isBmpCodePoint(cp2);
boolean b3 = Character.isBmpCodePoint(cp3);
boolean b4 = Character.isBmpCodePoint(cp4);
boolean b5 = Character.isBmpCodePoint(cp5);
System.err.println("The value for the first char comes to be: "+b1);
System.err.println("The value for the second char comes to be:"+b2);
System.err.println("The value for the third char comes to be: "+b3);
System.err.println("The value for the fourth char comes to be:"+b4);
System.err.println("The value for the fifth char comes to be: "+b5);
}
}
输出:
The value for the first char comes to be: true The value for the second char comes to be:true The value for the third char comes to be: true The value for the fourth char comes to be:true The value for the fifth char comes to be: true
相关用法
- Java Character isLetter()用法及代码示例
- Java Character isAlphabetic()用法及代码示例
- Java Character isValidCodePoint()用法及代码示例
- Java Character isISOControl()用法及代码示例
- Java Character isSpace()用法及代码示例
- Java Character isMirrored()用法及代码示例
- Java Character isIdentifierIgnorable()用法及代码示例
- Java Character isDigit()用法及代码示例
- Java Character isLowerCase()用法及代码示例
- Java Character isJavaIdentifierPart()用法及代码示例
- Java Character isUpperCase()用法及代码示例
- Java Character isLowSurrogate()用法及代码示例
- Java Character isJavaLetterOrDigit()用法及代码示例
- Java Character isWhitespace()用法及代码示例
- Java Character isDefined()用法及代码示例
- Java Character isJavaIdentifierstart()用法及代码示例
- Java Character isHighSurrogate()用法及代码示例
- Java Character isLetterOrDigit()用法及代码示例
- Java Character isSpaceChar()用法及代码示例
- Java Character codePointCount()用法及代码示例
注:本文由纯净天空筛选整理自 Java Character isBmpCodePoint() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。