iban4j icon indicating copy to clipboard operation
iban4j copied to clipboard

White spaces should not be considered when validating IBANs

Open leobeal opened this issue 7 years ago • 2 comments

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

leobeal avatar Nov 10 '17 14:11 leobeal

@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)

ccostin93 avatar Nov 29 '20 15:11 ccostin93

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

I would appreciate this.

FrankHossfeld avatar Nov 29 '20 18:11 FrankHossfeld

According to @leobeal comment, this is not the case

hajk1 avatar Aug 25 '23 20:08 hajk1