Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
63
Task/IBAN/EasyLang/iban.easy
Normal file
63
Task/IBAN/EasyLang/iban.easy
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
cc$[] = [ "AD" "AE" "AL" "AO" "AT" "AZ" "BA" "BE" "BF" "BG" "BH" "BI" "BJ" "BR" "CG" "CH" "CI" "CM" "CR" "CV" "CY" "CZ" "DE" "DK" "DO" "DZ" "EE" "EG" "ES" "FI" "FO" "FR" "GA" "GB" "GE" "GI" "GL" "GR" "GT" "HR" "HU" "IE" "IL" "IR" "IS" "IT" "JO" "KW" "KZ" "LB" "LI" "LT" "LU" "LV" "MC" "MD" "ME" "MG" "MK" "ML" "MR" "MT" "MU" "MZ" "NL" "NO" "PK" "PL" "PS" "PT" "QA" "RO" "RS" "SA" "SE" "SI" "SK" "SM" "SN" "TN" "TR" "UA" "VG" ]
|
||||
ln[] = [ 24 23 28 25 20 28 20 16 27 22 22 16 28 29 27 21 28 27 21 25 28 24 22 18 28 24 20 27 24 18 18 27 27 22 22 23 18 27 28 21 28 22 23 26 26 27 30 30 20 28 21 20 20 21 27 24 22 27 19 28 27 31 30 25 18 15 24 28 29 25 29 24 22 24 24 19 24 27 28 24 26 29 24 ]
|
||||
#
|
||||
func validcc iban$ .
|
||||
c$ = substr iban$ 1 2
|
||||
for i to len cc$[]
|
||||
if c$ = cc$[i]
|
||||
return if len iban$ = ln[i]
|
||||
.
|
||||
.
|
||||
return 0
|
||||
.
|
||||
func mod97 s$ .
|
||||
while s$ <> ""
|
||||
h$ = r div 10
|
||||
h$ &= r mod 10
|
||||
h$ &= substr s$ 1 13
|
||||
s$ = substr s$ 14 9999
|
||||
r = number h$ mod 97
|
||||
.
|
||||
return r
|
||||
.
|
||||
func isvalid hiban$ .
|
||||
for c$ in strchars hiban$
|
||||
c = strcode c$
|
||||
if c > 32
|
||||
if c >= 97 and c < 122
|
||||
c -= 32
|
||||
c$ = strchar c
|
||||
elif c < 48 or c > 57 and c < 65 or c > 90
|
||||
return 0
|
||||
.
|
||||
miban$ &= c$
|
||||
.
|
||||
.
|
||||
if validcc miban$ = 0
|
||||
return 0
|
||||
.
|
||||
for c$ in strchars substr miban$ 5 999 & substr miban$ 1 4
|
||||
c = strcode c$
|
||||
if c >= 65 and c <= 90
|
||||
t$ &= (c - 55) div 10
|
||||
t$ &= (c - 55) mod 10
|
||||
else
|
||||
t$ &= c$
|
||||
.
|
||||
.
|
||||
return if mod97 t$ = 1
|
||||
.
|
||||
proc check s$ . .
|
||||
write s$ & " is "
|
||||
if isvalid s$ = 1
|
||||
print "valid"
|
||||
else
|
||||
print "not valid"
|
||||
.
|
||||
.
|
||||
check "GB82 WEST 1234 5698 7654 32"
|
||||
check "GB82WEST12345698765432"
|
||||
check "gb82 west 1234 5698 7654 32"
|
||||
check "GB82 TEST 1234 5698 7654 32"
|
||||
check "GB82 WEST 1243 5698 7654 32"
|
||||
check "GB82 west 1243 5698 7654 32"
|
||||
Loading…
Add table
Add a link
Reference in a new issue