Package org.iban4j

Class IbanUtil

java.lang.Object
org.iban4j.IbanUtil

public final class IbanUtil extends Object
Iban Utility Class
  • Method Details

    • calculateCheckDigit

      public static String calculateCheckDigit(String iban) throws IbanFormatException
      Calculates Iban Check Digit.
      Parameters:
      iban - string value
      Returns:
      check digit as String
      Throws:
      IbanFormatException - if iban contains invalid character.
    • validate

      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.
      InvalidCheckDigitException
      UnsupportedCountryException
    • isValid

      public static boolean isValid(String iban)
      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.
      InvalidCheckDigitException
      UnsupportedCountryException
    • isValid

      public static boolean isValid(String iban, IbanFormat format)
      Validates iban.
      Parameters:
      iban - to be validated.
      format - to be used in validation.
      Returns:
      true if iban is valid
    • isSupportedCountry

      public static boolean isSupportedCountry(CountryCode countryCode)
      Checks whether country is supporting iban.
      Parameters:
      countryCode - CountryCode
      Returns:
      boolean true if country supports iban, false otherwise.
    • getIbanLength

      public static int getIbanLength(CountryCode countryCode)
      Returns iban length for the specified country.
      Parameters:
      countryCode - CountryCode
      Returns:
      the length of the iban for the specified country.
    • getCheckDigit

      public static String getCheckDigit(String iban)
      Returns iban's check digit.
      Parameters:
      iban - String
      Returns:
      checkDigit String
    • getCountryCode

      public static String getCountryCode(String iban)
      Returns iban's country code.
      Parameters:
      iban - String
      Returns:
      countryCode String
    • getCountryCodeAndCheckDigit

      public static String getCountryCodeAndCheckDigit(String iban)
      Returns iban's country code and check digit.
      Parameters:
      iban - String
      Returns:
      countryCodeAndCheckDigit String
    • getBban

      public static String getBban(String iban)
      Returns iban's bban (Basic Bank Account Number).
      Parameters:
      iban - String
      Returns:
      bban String
    • getAccountNumber

      public static String getAccountNumber(String iban)
      Returns iban's account number.
      Parameters:
      iban - String
      Returns:
      accountNumber String
    • getBankCode

      public static String getBankCode(String iban)
      Returns iban's bank code.
      Parameters:
      iban - String
      Returns:
      bankCode String
    • padLeft

      public static String padLeft(String str, int length, char padChar)
      Left padding a string with the given character
      Parameters:
      str - The string to be padded
      length - The total fix length of the string
      padChar - The pad character
      Returns:
      The padded string