arturmkrtchyan / iban4j

A Java library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362).
http://iban4j.org
Apache License 2.0
276 stars 125 forks source link

White spaces should not be considered when validating IBANs #39

Closed leobeal closed 1 year ago

leobeal commented 6 years ago

DE89370400440532013000 and DE89 3704 0044 0532 0130 00 should return the same result when validating IBANs.

Simply using iban.replaceAll("\\s+","") and always validating againg the version with no spaces solves the issue

ccostin93 commented 3 years ago

@leobeal This was already a capability of the library since 2015. You can use org.iban4j.Iban#valueOf(java.lang.String, org.iban4j.IbanFormat). This will either return an Iban instance or throw an error is the iban is invalid.

 Iban.valueOf("DE89 3704 0044 0532 0130 00", IbanFormat.Default)
FrankHossfeld commented 3 years ago

@ccostin93 cool work ... if you like, you can also add your PRs here: https://github.com/NaluKit/iban4g

I would appreciate this.

hajk1 commented 1 year ago

According to @leobeal comment, this is not the case