Java-lang-character-isunicodeidentifierpart-codepoint

提供:Dev Guides
移動先:案内検索

Java.lang.Character.isUnicodeIdentifierPart()メソッド

説明

  • java.lang.Character.isUnicodeIdentifierPart(int codePoint)*は、指定された文字(Unicodeコードポイント)が最初の文字以外のUnicode識別子の一部であるかどうかを判断します。

文字は、次のステートメントのいずれかが真である場合にのみ、Unicode識別子の一部である場合があります-

  • それは手紙です
  • それは接続句読点文字です( '_'のように)
  • それは数字です
  • それは数字です(ローマ数字など)。
  • それは結合マークです
  • それは非スペースマークです
  • isIdentifierIgnorableは、この文字に対してtrueを返します。

宣言

以下は* java.lang.Character.isUnicodeIdentifierPart()*メソッドの宣言です

public static boolean isUnicodeIdentifierPart(int codePoint)

パラメーター

*codePoint* -テストする文字(Unicodeコードポイント)

戻り値

このメソッドは、文字がUnicode識別子の一部である可能性がある場合はtrueを返し、そうでない場合はfalseを返します。

例外

NA

次の例は、lang.Character.isUnicodeIdentifierPart()メソッドの使用方法を示しています。

package com.finddevguides;

import java.lang.*;

public class CharacterDemo {

   public static void main(String[] args) {

     //create 2 int primitives cp1, cp2
      int cp1, cp2;

     //assign values to cp1, cp2
      cp1 = 0x053e;//represents ARMENIAN CAPITAL LETTER CA
      cp2 = 0x0040;//represents @

     //create 2 boolean primitives b1, b2
      boolean b1, b2;

     /**
 *check if cp1, cp2 may be part of a Unicode identifier
      * and assign results to b1, b2.
       */
      b1 = Character.isUnicodeIdentifierPart(cp1);
      b2 = Character.isUnicodeIdentifierPart(cp2);

      String str1 = "cp1 may be part of a Unicode identifier is " + b1;
      String str2 = "cp2 may be part of a Unicode identifier is " + b2;

     //print b1, b2 values
      System.out.println( str1 );
      System.out.println( str2 );
   }
}

上記のプログラムをコンパイルして実行すると、次の結果が生成されます-

cp1 may be part of a Unicode identifier is true
cp2 may be part of a Unicode identifier is false