添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
玩滑板的皮带  ·  Any demo converting a ...·  2 月前    · 
爱吹牛的水煮肉  ·  Go 每日一库之 ...·  4 月前    · 
完美的脸盆  ·  SiteMinder: The ...·  1 年前    · 
  • The java.lang.Character.isDigit(char ch) is an inbuilt method in java which determines whether a specified character is a digit or not. There are few conditions that a character must accomplish to be accepted as a digit. That is if the general category type of a character, provided by Character.getType(ch), is DECIMAL_DIGIT_NUMBER, then the character is a digit.
    Some Unicode character ranges that contain digits: From ‘\u0030’ to ‘\u0039’ : ISO-LATIN-1 digits (‘0’ through ‘9’)
    From ‘\u0660’ to ‘\u0669’ : Arabic-Indic digits
    From ‘\u06F0’ to ‘\u06F9’ : Extended Arabic-Indic digits
    From ‘\u0966’ to ‘\u096F’ : Devanagari digits
    From ‘\uFF10’ to ‘\uFF19’ : Fullwidth digits

    Apart from the above mentioned ranges, many other character ranges contain digits as well.

    Syntax:

    public static boolean isDigit(char ch)

    Parameter: This method accepts character parameter ch as an argument, which is to be tested.

    Return value: This method returns a boolean value. It returns True if ch is digit, else False.

    Note: This method cannot handle supplementary characters . To support all Unicode characters, including supplementary characters, use the isDigit(int) method.

    Below programs illustrate the above method:
    Program 1:

    // Function to check if is digit
    // is found or not
    for ( int i = 0 ; i < s.length(); i++) {
    if (Character.isDigit(
    s.charAt(i))
    == true ) {
    // return position of digit
    return i + 1 ;
    // return 0 if digit not present
    return 0 ;
    public static void main(String[] args)
    // Array of strings
    String[] arr = { "ABC4DEF" , "QWERTY" };
    // To store the position of digit
    int index = 0 ;
    // Traverse the array arr[] to find digit
    // within it's elements
    for (String x : arr) {
    index = search_digit(x);
    if (index != 0 ) {
    System.out.println(
    "Digit found at : "
    + (index)
    + "th position." );
    else {
    System.out.println(
    "Digit not present." );
  • The java.lang.Character.isDigit(int codePoint) is an inbuilt method in java which determines whether the specified Unicode code point character of integer type is a digit or not.
    There are few conditions that a character must accomplish to be accepted as a digit. That is if the general category type of a character, provided by getType(codepoint), is a DECIMAL_DIGIT_NUMBER, then the character is a digit. Some Unicode character ranges that contain digits: From ‘\u0030’ to ‘\u0039’ : ISO-LATIN-1 digits (‘0’ through ‘9’)
    From ‘\u0660’ to ‘\u0669’ : Arabic-Indic digits
    From ‘\u06F0’ to ‘\u06F9’ : Extended Arabic-Indic digits
    From ‘\u0966’ to ‘\u096F’ : Devanagari digits
    From ‘\uFF10’ to ‘\uFF19’ : Fullwidth digits

    Apart from the above mentioned ranges, many other character ranges contain digits as well.

    Syntax:

    public static boolean isDigit(int codePoint)

    Parameter: This method accepts unicode character parameter codePoint of integer type as an argument, which is to be tested.

    Return value: This method returns a boolean value. It returns True if the specified character is digit, else it returns False.

    Below programs illustrate the above method:
    Program 1:

    // This program demonstrates the use of
    // isDigit(int codePoint) method of Character class.
    import java.util.*;
    public class GFG {
    public static void main(String[] args)
    // create codePoints
    int cp1 = 57 ;
    int cp2 = 84 ;
    // Check whether the codePoints
    // are digit or not.
    System.out.println(
    "The codePoint cp1 is a digit -> "
    + Character.isDigit(cp1));
    System.out.println(
    "The codePoint cp2 is a digit -> "
    + Character.isDigit(cp2));
    // This program demonstrates the use of
    // isDigit(int codePoint) method of
    // Character class.
    import java.util.*;
    public class Main {
    public static void main(String[] args)
    // create codePoints
    int cp1 = 0x50 ;
    int cp2 = 0x06f8 ;
    // Check whether the codePoints
    // are digit or not.
    System.out.println(
    "The codePoint cp1 is a digit -> "
    + Character.isDigit(cp1));
    System.out.println(
    "The codePoint cp2 is a digit -> "
    + Character.isDigit(cp2));
    Character.isUnicodeIdentifierPart() Method in Java with Examples
    The java.lang.Character.isUnicodeIdentifierPart() is an inbuilt method in java that determines if the specified character 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 connecting punctuation character (such as '_'
    Character.equals() method in Java with examples
    The java.lang.Character.equals() is a function in Java which compares this object against the specified object. If the argument is not null then the result is true and is a Character object that represents the same char value as this object. Syntax: public boolean equals(Object obj) Parameters: The function accepts a single parameter obj which spec
    Character.getDirectionality() method in Java with examples
    The java.lang.Character.getDirectionality() is an inbuilt method in Java which returns the Unicode directionality property for the given character. Character directionality is used to calculate the visual ordering of text. The directionality value of undefined char values is DIRECTIONALITY_UNDEFINED. This method cannot handle supplementary characte
    Character.isISOControl() method with examples in Java
    The java.lang.Character.isISOControl() is an inbuilt method in java which determines if the specified character is an ISO control character or not. A character is considered to be an ISO control character if its code is in the range ‘\u0000’ through ‘\u001F’ or in the range ‘\u007F’ through ‘\u009F’. This method cannot handle supplementary characte
    Character.isValidCodePoint() Method in Java with Examples
    The Character.isValidCodePoint() is an inbuilt method in java that determines whether the specified code point mentioned in the parameter is a valid Unicode code point value or not. Syntax: public static boolean isValidCodePoint(int codePoint) Parameters: The parameter codePoint is of Integer datatype and refers to the unicode code point that is to
    Character.isJavaIdentifierPart() Method in Java with Examples
    The Character.isJavaIdentifierPart(int codePoint) is an inbuilt method in java that determines if the specified character may be part of a Java identifier as other than the first character. A character may be a part of Java identifier if any of the following are true: it is a letter it is a currency symbol (such as ‘$’) it is a connecting punctuati
    Character.isWhitespace() method in Java with examples
    The java.lang.Character.isWhitespace() is an inbuilt method in a java that determines if the specified character (Unicode code point) is white space according to Java. A character is a Java whitespace character if and only if it satisfies one of the following criteria: It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or PARAGRAPH_S
    Character getType() Method in Java with examples
    The Character.getType(char ch) is an inbuilt method in java that returns a value indicating a character’s general category. This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the getType(int) method. Syntax:public static int getType(char ch)Parameters: The method accepts on
    Character.isLowSurrogate() method in Java with examples
    The java.lang.Character.isLowSurrogate(char ch) is an inbuilt method in java which determines if the given char value is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit). Such values do not represent characters by themselves but are used in the representation of supplementary characters in the UTF-16 encoding. Syntax:
    Character.isHighSurrogate() method in Java with examples
    The java.lang.Character.isHighSurrogate() is a inbuilt method in java which determines if the given char value is a Unicode high-surrogate code unit (also known as leading-surrogate code unit). Such values do not represent characters by themselves but are used in the representation of supplementary characters in the UTF-16 encoding. Syntax: public
    We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It !
    Please go through our recently updated Improvement Guidelines before submitting any improvements.
    This article is being improved by another user right now. You can suggest the changes for now and it will be under the article's discussion tab.
    You will be notified via email once the article is available for improvement. Thank you for your valuable feedback!
    Please go through our recently updated Improvement Guidelines before submitting any improvements.
    Suggest Changes
    Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
  •