Android String Parse isIDCard(String str)

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

Description

is ID Card

Declaration

public static boolean isIDCard(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static boolean isIDCard(String str) {
        int length = str.length();
        return isNumber(str) && (length == 15 || length == 18);
    }//from www.jav a  2  s .  co  m

    public static boolean isNumber(String str) {
        try {
            Integer.parseInt(str);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. isDecimal(String str)
  2. isDifferent(String str1, String str2)
  3. isDigits(Object o)
  4. isDigits(String s)
  5. isDouble(String str)
  6. isInteger(String input)
  7. isInteger(String str)
  8. isIntegral(String str)
  9. isInt(String str)