Java源码示例:org.iban4j.IbanUtil
示例1
public void validateIban(String iban)
throws IbanFormatException, InvalidCheckDigitException, UnsupportedCountryException {
CountryCode countryCode = CountryCode.getByCode(IbanUtil.getCountryCode(iban));
if (countryCode == null) {
throw new UnsupportedCountryException("Country code is not supported.");
}
if (IbanUtil.isSupportedCountry(countryCode)) {
IbanUtil.validate(iban);
}
}
示例2
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 1)
@Test
@Ignore
public void ibanValidation() {
for(int i = 0; i < LOOPS_COUNT; i++) {
IbanUtil.validate("DE89370400440532013000");
}
}
示例3
public static boolean valid(final String iban) {
try {
IbanUtil.validate(iban);
}
catch (Exception e){
return false;
}
return true;
}