Bankster v0.3.0 Bankster.Iban View Source
Provides some IBAN related functions.
Link to this section Summary
Functions
Returns the BBAN of the given IBAN
Returns the country code of the given IBAN
Formats and returns a given IBAN in compact format
Formats and returns a given IBAN in pretty format
Returns the size/length of the given IBAN
Validates a string whether it’s a valid IBAN and returns a boolen value
Validates a string whether it’s a valid IBAN an returns an error tuple on invalid data
Link to this section Functions
Returns the country code of the given IBAN.
Examples
iex> Bankster.Iban.country_code("DK8387188644726815")
"DK"
Formats and returns a given IBAN in compact format.
Examples
iex> Bankster.Iban.format_compact("DK8 38 7188 64472 6815 ")
"DK8387188644726815"
Formats and returns a given IBAN in pretty format.
Examples
iex> Bankster.Iban.format_pretty("DK8387188644726815")
"DK838 7188 64472 6815"
Returns the size/length of the given IBAN.
Examples
iex> Bankster.Iban.size("DK 8387 188644 726815")
18
Validates a string whether it’s a valid IBAN and returns a boolen value.
Examples
iex> Bankster.Iban.valid?("INVALIDIBAN")
false
iex> Bankster.Iban.valid?("DK8387188644726815")
true
Validates a string whether it’s a valid IBAN an returns an error tuple on invalid data.
Examples
iex> Bankster.Iban.validate("INVALIDIBAN")
{:error, :invalid_country}
iex> Bankster.Iban.validate("DK838718234242342348644726815")
{:error, :invalid_length}
iex> Bankster.Iban.validate("DK8387188644726815")
{:ok, "DK8387188644726815"}