How to verify PAN card?

前端 未结 15 1778
予麋鹿
予麋鹿 2021-02-13 11:46

How to check the validation of edittext for pan card like \"ABCDE1234F\". I am confused how to check the the validation for this. Please help me guys. I will appreciate any kind

15条回答
  •  没有蜡笔的小新
    2021-02-13 12:07

    As per Income Tax Act, the guidelines for PAN Card are as follows:

    Format For Pan Card : Eg. ABCDE0123F

    Income Tax PAN card is issued under Section 139A of the Income Tax Act. The PAN structure is as follows: AAAPL1234C: The five (5) first characters are letters, followed by four (4) numerals, and the last (10th) character is a letter. The fourth (4th) character informs about the holder of the card.

    For more Information regarding Pan card : https://en.m.wikipedia.org/wiki/Permanent_account_number

    For Code Validation : "[A-Z]{5}[0-9]{4}[A-Z]{1}"

    For Java :

    public static boolean isPanCardValid(String pan_number) {
    
      Pattern pattern = Pattern.compile("[A-Z]{5}[0-9]{4}[A-Z]{1}");
    
      Matcher matcher = pattern.matcher(pan_number);
      // Check if pattern matches
      if (matcher.matches()) {
        return true;
      } else {
        return false;
      }
    }

    where isPanCardValid() is static method, which accepts string as parameter(String pan_number) input from User and matches with PanCard Pattern and returns the value as true or false.

提交回复
热议问题