java.lang.Character isUnicodeIdentifierPart(int codePoint)

Description

The Character.isUnicodeIdentifierPart(int codePoint) java method determines if the specified character (Unicode code point) may be part of a Unicode identifier as other than the first character.

A character may be part of a Unicode identifier if and only if one of the following statements is true:

  • it is a letter
  • it is a connecting punctuation character (such as ‘_’)
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable returns true for this character.

The isUnicodeIdentifierPart(int codePoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Character.isUnicodeIdentifierPart(int codePoint)

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java isUnicodeIdentifierPart() method non statically.

Method Syntax

public static boolean isUnicodeIdentifierPart(int codePoint)

Method Argument

Data Type Parameter Description
int codepoint the character (Unicode code point) to be tested.

Method Returns

The isUnicodeIdentifierPart(int codePoint) method of Character class returns true if the character may be part of a Unicode identifier; false otherwise.

Compatibility

Requires Java 1.5 and up

Java Character isUnicodeIdentifierPart(int codePoint) Example

Below is a simple java example on the usage of isUnicodeIdentifierPart(int codePoint) method of Character class.

package com.javatutorialhq.java.examples;

/*
 * This example source code demonstrates the use of 
 * isUnicodeIdentifierPart(int codePoint) method of Character class.
 */

public class CharacterIsUnicodeIdentifierPartCodepointExample {

	public static void main(String[] args) {
		
		// initialize a codepoint
		int codepoint = 89;		

		/*
		 * check if the specified character (Unicode code point) is 
		 * permissible as part of a Unicode identifier.
		 */

		boolean checkBool = Character.isUnicodeIdentifierPart(codepoint);
		// print result
		if (checkBool) {
			System.out.print("User input '" + codepoint + "' is permissible as part "
					+ "of a Unicode identifier");
		} else {
			System.out.print("User input '" + codepoint + "' is not permissible as part "
					+ "of a Unicode identifier");
		}
		
	}

}

Sample Output

Below is the sample output when you run the above example.

java Character isUnicodeIdentifierPart(int codePoint) example output