Jump to content

IBAN: Difference between revisions

m
→‎{{header|Sidef}}: modified code to work with Sidef 2.10
m (→‎more checking: re-instated original IBAN numbers.)
m (→‎{{header|Sidef}}: modified code to work with Sidef 2.10)
Line 2,887:
<lang ruby>func valid_iban(iban) {
static len = Hash.new(
AD:=>24, AE:=>23, AL:=>28, AO:=>25, AT:=>20, AZ:=>28, BA:=>20, BE:=>16, BF:=>27, BG:22,
BG=>22, BH:=>22, BI:=>16, BJ:=>28, BR:=>29, CG:=>27, CH:=>21, CI:=>28, CM:=>27, CR:21, CV:25,
CR=>21, CV=>25, CY:=>28, CZ:=>24, DE:=>22, DK:=>18, DO:=>28, DZ:=>24, EE:=>20, EG:27, ES:24, FI:18,
EG=>27, ES=>24, FI=>18, FO:=>18, FR:=>27, GA:=>27, GB:=>22, GE:=>22, GI:=>23, GL:18, GR:27, GT:28, HR:21,
GL=>18, GR=>27, GT=>28, HR=>21, HU:=>28, IE:=>22, IL:=>23, IR:=>26, IS:=>26, IT:27, JO:30, KW:30, KZ:20, LB:28,
LI:21IT=>27, LT:20JO=>30, LU:20KW=>30, LV:21KZ=>20, MC:27LB=>28, MD:24LI=>21, ME:22LT=>20, MG:27LU=>20, MK:19, ML:28LV=>21,
MR:MC=>27, MT:31MD=>24, MU:30ME=>22, MZ:25MG=>27, NL:18MK=>19, NO:15ML=>28, PK:24MR=>27, PL:28MT=>31, PS:29, PT:25MU=>30,
QA:29MZ=>25, RO:24NL=>18, RS:22NO=>15, SA:PK=>24, SE:24PL=>28, SI:19PS=>29, SK:24PT=>25, SM:27QA=>29, SN:28, TN:RO=>24,
RS=>22, SA=>24, SE=>24, SI=>19, SK=>24, SM=>27, SN=>28, TN=>24, TR=>26,
TR:26, UA:=>29, VG:=>24,
);
 
Line 2,904 ⟶ 2,905:
# Validate country code against expected length.
var cc = iban.substr(0, 2);
iban.len == len[{cc]} || return false;
 
# Shift and convert.
2,747

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.