exiban v0.0.5 ExIban
Validate and manipulate IBAN account number.
Summary
Functions
Returns bban extracted from IBAN
Returns country code extracted from IBAN
Format and pretify IBAN to be more readable
Format and IBAN to compacted version
Checks if IBAN is valid
Perform validation rules on IBAN
Functions
Specs
bban(bitstring) :: bitstring
Returns bban extracted from IBAN.
Examples
iex> ExIban.bban("GB82 WEST 1234 5698 7654 32")
"82"
Specs
country_code(bitstring) :: bitstring
Returns country code extracted from IBAN.
Examples
iex> ExIban.country_code("GB82 WEST 1234 5698 7654 32")
"GB"
Specs
format(bitstring) :: bitstring
Format and pretify IBAN to be more readable.
Examples
iex> ExIban.format(" GB 82 WEST 1234 5698765432 ")
"GB82 WEST 1234 5698 7654 32"
Specs
format_compact(bitstring) :: bitstring
Format and IBAN to compacted version.
Examples
iex> ExIban.format_compact(" GB 82 WEST 1234 5698765432 ")
"GB82WEST12345698765432"
Specs
valid?(bitstring) :: true | false
Checks if IBAN is valid.
Examples
iex> ExIban.valid?("GB82 WEST 1234 5698 7654 32")
true
iex> ExIban.valid?("GB82 WEST 999 9999 9999")
false
iex> ExIban.valid?(nil)
false
Specs
validate(bitstring) :: :ok | {:error, list}
Perform validation rules on IBAN.
Examples
iex> ExIban.validate("GB82 WEST 1234 5698 7654 32")
:ok
iex> ExIban.validate("GB82 WEST 999 9999 9999")
{ :error, [:bad_length, :bad_format, :bad_check_digits] }
iex> ExIban.validate(nil)
{ :error, [:too_short] }