java.lang.Character isDigit(int codePoint)

Description

The Character.isDigit(int codePoint) java method determines if the specified character (Unicode code point) is a digit.

A character is a digit if its general category type, provided by getType(codePoint), is DECIMAL_DIGIT_NUMBER.

Some Unicode character ranges that contain digits:

  • ‘u0030’ through ‘u0039’, ISO-LATIN-1 digits (‘0’ through ‘9’)
  • ‘u0660’ through ‘u0669’, Arabic-Indic digits
  • ‘u06F0’ through ‘u06F9’, Extended Arabic-Indic digits
  • ‘u0966’ through ‘u096F’, Devanagari digits
  • ‘uFF10’ through ‘uFF19’, Fullwidth digits

Many other character ranges contain digits as well.

The isDigit(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:

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 isDigit() method non statically.

Method Syntax

public static boolean isDigit(int codePoint)

Method Argument

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

Method Returns

The isDigit(int codePoint) method of Character class returns true if the character is a digit; false otherwise.

Compatibility

Requires Java 1.5 and up

Java Character isDigit(int codePoint) Example

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

Sample Output

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

java Character isDigit(int codepoint) example output