# `Iban`

An international bank account number, with its check digits: `GB29NWBK60161331926819`.

Use it for bank accounts in countries that use IBANs. To hold any kind of account, use [`BankAccount`](/docs/types/type-bank-account.md), which can contain one.

## Shape

One value, held as text in one set form, with no parts: `MT84MALT011000012345MTLCAST001S`.

## Example

```jadpo
Iban("GB29NWBK60161331926819")
```

`Iban(raw)` checks the text, and text that isn't one breaks the `format` rule.

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

## Good to know

- It has to be upper case with no spaces, so tidy what a person types before you build one.
- `text.format` shows it in groups of four.
- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it.
- A field that holds one counts as personal data (`financial`), so you don't mark it yourself.

## In JSON

A string, in a request, a response or `json.write`:

```json
"GB29NWBK60161331926819"
"DE89370400440532013000"
"FR1420041010050500013M02606"
```

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`Iban` is in the group Money and banking, and has been in Jadpo since 0.1.0.

### Text form

`text.from` writes one standard text form, the same form `text.parse` reads back: `GB29NWBK60161331926819`, `DE89370400440532013000` and `FR1420041010050500013M02606`.

### How it is stored

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

### How it is 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 also takes `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
