Closed leobeal closed 1 year 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)
@ccostin93 cool work ... if you like, you can also add your PRs here: https://github.com/NaluKit/iban4g
I would appreciate this.
According to @leobeal comment, this is not the case
DE89370400440532013000
andDE89 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