# `Iban`

An IBAN (ISO 13616) in its electronic form, upper case with no spaces, its mod-97 check digits passing: `GB29NWBK60161331926819`. Shown to people in fours.

[Money and banking](types.md#money-and-banking); not ordered; personal data (financial); since Jadpo 0.1.0.

## Make one

Build one from its text, `Iban("GB29NWBK60161331926819")`, which checks it: text that isn't one breaks `format`.

`text.parse(raw, as: Iban)` reads one from its text; text that isn't one at all fails `malformed`, such as `GB29NWBK60161331926818`, `GB29 NWBK 6016 1331 9268 19` or `gb29nwbk60161331926819`.

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends its canonical text as a string.

| Text | JSON |
|---|---|
| `GB29NWBK60161331926819` | `"GB29NWBK60161331926819"` |
| `DE89370400440532013000` | `"DE89370400440532013000"` |
| `FR1420041010050500013M02606` | `"FR1420041010050500013M02606"` |
| `NO9386011117947` | `"NO9386011117947"` |
| `MT84MALT011000012345MTLCAST001S` | `"MT84MALT011000012345MTLCAST001S"` |

It is stored in one column named for the field, of type `text`. `FR1420041010050500013M02606` is stored as `'FR1420041010050500013M02606'`.

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `GB29NWBK60161331926819` | `GB29 NWBK 6016 1331 9268 19` |
| `DE89370400440532013000` | `DE89 3704 0044 0532 0130 00` |
| `FR1420041010050500013M02606` | `FR14 2004 1010 0505 0001 3M02 606` |
| `NO9386011117947` | `NO93 8601 1117 947` |
| `MT84MALT011000012345MTLCAST001S` | `MT84 MALT 0110 0001 2345 MTLC AST0 01S` |

## Operations

It has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
