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:Main.java

public static boolean isNumeric(String str) {
    for (char c : str.toCharArray()) {
        if (!Character.isDigit(c))
            return false;
    }//from ww  w  .  j  a  v a  2  s.  c  o m
    return true;
}

From source file:Main.java

public static boolean isNumeric(String str) {
    for (int i = 0; i < str.length(); i++) {
        if (!Character.isDigit(str.charAt(i))) {
            return false;
        }//w  ww . ja  v a 2s.co  m
    }
    return true;
}

From source file:Main.java

public static boolean isAllDigital(char[] chars) {
    boolean result = true;
    for (int w = 0; w < chars.length; w++) {
        if (!Character.isDigit(chars[w])) {
            result = false;//from  w w  w .  j  a v  a 2s . c  om
            break;
        }
    }
    return result;
}

From source file:Main.java

public static boolean isJustDigitStar(String str) {
    int len = 0;/*from ww w . ja  v a  2  s . c o m*/
    for (int idx = 0; idx < str.length(); idx++) {
        if (Character.isDigit(str.charAt(idx)) || str.charAt(idx) == '.') {
            len++;
        }
    }
    if (len == str.length()) {
        return true;
    }
    return false;
}

From source file:Main.java

public static boolean isJustDigitStar1(String str) {
    int len = 0;//from  ww  w  . j a va2 s . c o  m
    for (int idx = 0; idx < str.length(); idx++) {
        if (Character.isDigit(str.charAt(idx)) || str.charAt(idx) == '*' || str.charAt(idx) == '-') {
            len++;
        }
    }
    if (len == str.length()) {
        return true;
    }
    return false;
}

From source file:Main.java

public static boolean isNumeric(String str) {
    for (int i = 0; i < str.length(); i++) {
        System.out.println(str.charAt(i));
        if (!Character.isDigit(str.charAt(i))) {
            return false;
        }// w  ww . j  ava 2 s  . c  o  m
    }
    return true;
}

From source file:Main.java

public static boolean isNumeric(String str) {
    if (str == null)
        return false;

    for (char c : str.toCharArray()) {
        if (!Character.isDigit(c))
            return false;
    }/* w ww .  j  a  va2  s  . c o m*/
    return true;
}

From source file:Main.java

public static boolean canBeCompilerOptionValue(final String text) {
    if (text.startsWith("-")) { // option or negative number
        return text.length() > 1 && Character.isDigit(text.charAt(1));
    }/*ww  w. j  av  a  2  s.c  o  m*/
    return !text.startsWith("+");
}

From source file:Main.java

public static boolean isNumeric(String str) {
    if (str == null) {
        return false;
    }/*www.  j  av a2s  . c om*/
    for (int i = str.length(); --i >= 0;) {
        if (!Character.isDigit(str.charAt(i))) {
            return false;
        }
    }
    return true;
}

From source file:Main.java

public static boolean isNum(String str) {
    boolean ret = false;
    if (str != null) {
        for (int i = str.length(); --i >= 0;) {
            if (!Character.isDigit(str.charAt(i))) {
                ret = false;//  w w  w. j  a va 2s.  c o m
                break;
            }
        }
        ret = true;

    }
    return ret;
}