Example usage for java.lang Character isDigit

List of usage examples for java.lang Character isDigit

Introduction

In this page you can find the example usage for java.lang Character isDigit.

Prototype

public static boolean isDigit(int codePoint) 

Source Link

Document

Determines if the specified character (Unicode code point) is a digit.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    char symbol = 'A';

    if (Character.isDigit(symbol)) {
        System.out.println("true");
    } else {//from ww w  .ja v a2  s . co  m
        System.out.println("false");
    }
}

From source file:MainCLass.java

public static void main(String[] args) {
    System.out.println("Is the Latin symbol 6 a digit? " + Character.isDigit('6'));

    System.out.println("Is the Tamil symbol corresponding to " + "Unicode value '\\u0beb' a digit? "
            + Character.isDigit('\u0beb'));

    System.out.println("Is the Greek symbol Omega a digit? " + Character.isDigit('\u03a9'));

    System.out.println("Is the Latin symbol A a digit? " + Character.isDigit('A'));

}

From source file:MainClass.java

public static void main(String args[]) {
    System.out.println(Character.isDigit('8'));
}

From source file:Main.java

public static void main(String[] args) {
    String str = "5 123,123,qwe,1,123, 25";
    str.chars().filter(n -> !Character.isDigit((char) n) && !Character.isWhitespace((char) n))
            .forEach(n -> System.out.print((char) n));

}

From source file:Main.java

public static void main(String[] args) {
    int intChar = (int) '0';
    System.out.println(intChar);/*from ww w  .j  av a  2 s .c om*/
    System.out.println(Character.isDigit(intChar));
}

From source file:Main.java

public static void main(String[] args) {
    for (char ch = Character.MIN_VALUE; ch < Character.MAX_VALUE; ch++) {
        if (Character.isDigit(ch)) {
            String s = String.format("\\u%04x", (int) ch);
            System.out.println(s);
        }/*w w  w . j  av a2s.  c  om*/
    }
}

From source file:Main.java

public static void main(String[] args) {
    String numbers = "1234567890";
    for (int i = 0; i < numbers.length(); i++) {
        if (Character.isDigit(numbers.charAt(i))) {
            System.out.println(numbers.charAt(i) + " is a number.");
        } else {/*from w  ww . j av a 2 s.c  om*/
            System.out.println(numbers.charAt(i) + " not a number.");
        }
    }
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    char ch = 'a';
    if (Character.isLetter(ch)) { // true
    }/*from ww  w  .  j a v  a 2s  .  c  om*/
    if (Character.isDigit(ch)) { // false
    }
    if (Character.isLowerCase(ch)) { // true
    }
    if (Character.isUpperCase(ch)) { // false
    }
}

From source file:IsDemo.java

public static void main(String args[]) {
    char a[] = { 'a', 'b', '5', '?', 'A', ' ' };

    for (int i = 0; i < a.length; i++) {
        if (Character.isDigit(a[i]))
            System.out.println(a[i] + " is a digit.");
        if (Character.isLetter(a[i]))
            System.out.println(a[i] + " is a letter.");
        if (Character.isWhitespace(a[i]))
            System.out.println(a[i] + " is whitespace.");
        if (Character.isUpperCase(a[i]))
            System.out.println(a[i] + " is uppercase.");
        if (Character.isLowerCase(a[i]))
            System.out.println(a[i] + " is lowercase.");
    }//  w  ww . j  a  v a 2s.c  o  m
}

From source file:Main.java

public static void main(String[] args) {

    char a[] = { 'a', 'b', '5', '?', 'A', ' ' };

    for (int i = 0; i < a.length; i++) {

        if (Character.isDigit(a[i]))
            System.out.println(a[i] + "is a digit ");
        if (Character.isLetter(a[i]))
            System.out.println(a[i] + "is a letter ");
        if (Character.isWhitespace(a[i]))
            System.out.println(a[i] + "is a White Space ");
        if (Character.isLowerCase(a[i]))
            System.out.println(a[i] + "is a lower case ");
        if (Character.isLowerCase(a[i]))
            System.out.println(a[i] + "is a upper case ");
    }//from w  w  w  . j  a va  2s . c  om

}