Java-lang-character-isidentifierignorable
提供:Dev Guides
Java.lang.Character.isIdentifierIgnorable()メソッド
説明
- java.lang.Character.isIdentifierIgnorable(char ch)*は、指定された文字をJava識別子またはUnicode識別子の無視可能な文字と見なすべきかどうかを決定します。
次のUnicode文字は、Java識別子またはUnicode識別子で無視できます-
- 空白ではないISO制御文字
- 「\ u0000」から「\ u0008」
- 「\ u000E」から「\ u001B」
- 「\ u007F」から「\ u009F」
- FORMAT一般カテゴリ値を持つすべての文字
宣言
以下は* java.lang.Character.isIdentifierIgnorable()*メソッドの宣言です
public static boolean isIdentifierIgnorable(char ch)
パラメーター
*ch* -テストする文字
戻り値
このメソッドは、文字がJavaまたはUnicode識別子の一部である無視できる制御文字である場合はtrueを返し、そうでない場合はfalseを返します。
例外
NA
例
次の例は、lang.Character.isIdentifierIgnorable()メソッドの使用方法を示しています。
package com.finddevguides;
import java.lang.*;
public class CharacterDemo {
public static void main(String[] args) {
//create 2 character primitives ch1, ch2
char ch1, ch2;
//assign values to ch1, ch2
ch1 = '\u0000';
ch2 = '8';
//create 2 boolean primitives b1, b2
boolean b1, b2;
//assign isIdentifierIgnorable results of ch1, ch2 to b1, b2
b1 = Character.isIdentifierIgnorable(ch1);
b2 = Character.isIdentifierIgnorable(ch2);
String str1 = "ch1 is an ignorable control character is " + b1;
String str2 = "ch2 is an ignorable control character is " + b2;
//print b1, b2 values
System.out.println( str1 );
System.out.println( str2 );
}
}
上記のプログラムをコンパイルして実行すると、次の結果が生成されます-
ch1 is an ignorable control character is true
ch2 is an ignorable control character is false