1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/// Returns the expected IBAN length for a given country code, if known.
pub(super) fn country_iban_length(country_code: &str) -> Option<usize> {
match country_code {
"AD" => Some(24), // Andorra
"AE" => Some(23), // United Arab Emirates
"AL" => Some(28), // Albania
"AT" => Some(20), // Austria
"BA" => Some(20), // Bosnia and Herzegovina
"BE" => Some(16), // Belgium
"BG" => Some(22), // Bulgaria
"BH" => Some(22), // Bahrain
"BR" => Some(29), // Brazil
"BY" => Some(28), // Belarus
"CH" => Some(21), // Switzerland
"CR" => Some(22), // Costa Rica
"CY" => Some(28), // Cyprus
"CZ" => Some(24), // Czech Republic
"DE" => Some(22), // Germany
"DK" => Some(18), // Denmark
"DO" => Some(28), // Dominican Republic
"EE" => Some(20), // Estonia
"EG" => Some(29), // Egypt
"ES" => Some(24), // Spain
"FI" => Some(18), // Finland
"FO" => Some(18), // Faroe Islands
"FR" => Some(27), // France
"GB" => Some(22), // United Kingdom
"GE" => Some(22), // Georgia
"GI" => Some(23), // Gibraltar
"GL" => Some(18), // Greenland
"GR" => Some(27), // Greece
"GT" => Some(28), // Guatemala
"HR" => Some(21), // Croatia
"HU" => Some(28), // Hungary
"IE" => Some(22), // Ireland
"IL" => Some(23), // Israel
"IQ" => Some(23), // Iraq
"IS" => Some(26), // Iceland
"IT" => Some(27), // Italy
"JO" => Some(30), // Jordan
"KW" => Some(30), // Kuwait
"KZ" => Some(20), // Kazakhstan
"LB" => Some(28), // Lebanon
"LC" => Some(32), // Saint Lucia
"LI" => Some(21), // Liechtenstein
"LT" => Some(20), // Lithuania
"LU" => Some(20), // Luxembourg
"LV" => Some(21), // Latvia
"LY" => Some(25), // Libya
"MC" => Some(27), // Monaco
"MD" => Some(24), // Moldova
"ME" => Some(22), // Montenegro
"MK" => Some(19), // North Macedonia
"MR" => Some(27), // Mauritania
"MT" => Some(31), // Malta
"MU" => Some(30), // Mauritius
"NL" => Some(18), // Netherlands
"NO" => Some(15), // Norway
"PK" => Some(24), // Pakistan
"PL" => Some(28), // Poland
"PS" => Some(29), // Palestine
"PT" => Some(25), // Portugal
"QA" => Some(29), // Qatar
"RO" => Some(24), // Romania
"RS" => Some(22), // Serbia
"SA" => Some(24), // Saudi Arabia
"SC" => Some(31), // Seychelles
"SD" => Some(18), // Sudan
"SE" => Some(24), // Sweden
"SI" => Some(19), // Slovenia
"SK" => Some(24), // Slovakia
"SM" => Some(27), // San Marino
"ST" => Some(25), // Sao Tome and Principe
"SV" => Some(28), // El Salvador
"TL" => Some(23), // Timor-Leste
"TN" => Some(24), // Tunisia
"TR" => Some(26), // Turkey
"UA" => Some(29), // Ukraine
"VA" => Some(22), // Vatican City
"VG" => Some(24), // Virgin Islands, British
"XK" => Some(20), // Kosovo
_ => None,
}
}