androidvalidationiban

Validate IBAN using org.apache.commons.validator


In a android project i have a EditText where the user can insert his IBAN

i then validate the IBAN like this, using org.apache.commons.validator

IBANCheckDigit iBANCheckDigit = new IBANCheckDigit();
Boolean validIBAN = iBANCheckDigit.isValid(textIBAN.getText().toString());

But the 'isValid" returns true when i write things like "Jjjhh" or "asdasd" is there a better way to validate a IBAN ?


Solution

  • IBANCheckDigit does not check the format of the IBAN number, only the check digits. IBAN length, structure, etc. is up to you. As an alternative, you could use iban4j which validates structure, length, etc. too.