Package org.iban4j
Class IbanUtil
java.lang.Object
org.iban4j.IbanUtil
Iban Utility Class
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcalculateCheckDigit(String iban) Calculates Iban Check Digit.static StringgetAccountNumber(String iban) Returns iban's account number.static StringgetBankCode(String iban) Returns iban's bank code.static StringReturns iban's bban (Basic Bank Account Number).static StringgetCheckDigit(String iban) Returns iban's check digit.static StringgetCountryCode(String iban) Returns iban's country code.static StringReturns iban's country code and check digit.static intgetIbanLength(CountryCode countryCode) Returns iban length for the specified country.static booleanisSupportedCountry(CountryCode countryCode) Checks whether country is supporting iban.static booleanValidates iban.static booleanisValid(String iban, IbanFormat format) Validates iban.static StringLeft padding a string with the given characterstatic voidValidates iban.static voidvalidate(String iban, IbanFormat format) Validates iban.
-
Method Details
-
calculateCheckDigit
Calculates Iban Check Digit.- Parameters:
iban- string value- Returns:
- check digit as String
- Throws:
IbanFormatException- if iban contains invalid character.
-
validate
public static void validate(String iban) throws IbanFormatException, InvalidCheckDigitException, UnsupportedCountryException Validates iban.- Parameters:
iban- to be validated.- Throws:
IbanFormatException- if iban is invalid. UnsupportedCountryException if iban's country is not supported. InvalidCheckDigitException if iban has invalid check digit.InvalidCheckDigitExceptionUnsupportedCountryException
-
isValid
Validates iban.- Parameters:
iban- to be validated.- Returns:
- true if the iban is valid
-
validate
public static void validate(String iban, IbanFormat format) throws IbanFormatException, InvalidCheckDigitException, UnsupportedCountryException Validates iban.- Parameters:
iban- to be validated.format- to be used in validation.- Throws:
IbanFormatException- if iban is invalid. UnsupportedCountryException if iban's country is not supported. InvalidCheckDigitException if iban has invalid check digit.InvalidCheckDigitExceptionUnsupportedCountryException
-
isValid
Validates iban.- Parameters:
iban- to be validated.format- to be used in validation.- Returns:
- true if iban is valid
-
isSupportedCountry
Checks whether country is supporting iban.- Parameters:
countryCode-CountryCode- Returns:
- boolean true if country supports iban, false otherwise.
-
getIbanLength
Returns iban length for the specified country.- Parameters:
countryCode-CountryCode- Returns:
- the length of the iban for the specified country.
-
getCheckDigit
Returns iban's check digit.- Parameters:
iban- String- Returns:
- checkDigit String
-
getCountryCode
Returns iban's country code.- Parameters:
iban- String- Returns:
- countryCode String
-
getCountryCodeAndCheckDigit
Returns iban's country code and check digit.- Parameters:
iban- String- Returns:
- countryCodeAndCheckDigit String
-
getBban
Returns iban's bban (Basic Bank Account Number).- Parameters:
iban- String- Returns:
- bban String
-
getAccountNumber
Returns iban's account number.- Parameters:
iban- String- Returns:
- accountNumber String
-
getBankCode
Returns iban's bank code.- Parameters:
iban- String- Returns:
- bankCode String
-
padLeft
Left padding a string with the given character- Parameters:
str- The string to be paddedlength- The total fix length of the stringpadChar- The pad character- Returns:
- The padded string
-