Android String Parse isIntegral(String str)

Here you can find the source of isIntegral(String str)

Description

is Integral

Declaration

public static boolean isIntegral(String str) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean isIntegral(String str) {
        if (str.startsWith("-")) {
            if (str.length() == 1) {
                return false;
            }//  w  ww.  j  av a2  s.c om
            str = str.substring(1);
        }
        if ((str.startsWith("0")) && (str.length() > 1)) {
            return false;
        }
        return isAllCharDigit(str);
    }

    public static boolean isAllCharDigit(String str) {
        int length = str.length();
        if (length == 0) {
            return false;
        }
        for (int i = 0; i < length; i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. isDigits(String s)
  2. isDouble(String str)
  3. isIDCard(String str)
  4. isInteger(String input)
  5. isInteger(String str)
  6. isInt(String str)
  7. isNumeric(String str)