Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,40 @@
//
// Validate International Securities Identification Number
// At entry ISIN string
// Exits with Boolean Valid or Invalid
//
local fn ISINisValid (ISIN as CFStringRef) as Boolean
// Base36 = @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Int r, v = 0, c, x2(9) = {0,2,4,6,8,1,3,5,7,9}
if len(ISIN) <> 12 then return _False
if ucc(ISIN, 0) < _"A" || ucc(ISIN, 1) < _"A" then return _False
// convert Base 36 digits to Base 10
uint64 n = 0
for r = 0 to len(ISIN) - 1
c = ucc(ISIN, r)
select
case c >= _"A" && c <= _"Z" : n = n * 100 + c - 55
case c >= _"0" && c <= _"9" : n = n * 10 + c - 48
case else : return _False
end select
next
// Luhn test
while n
v += n % 10 + x2(n / 10 % 10)
n /= 100
wend
end fn = !(v mod 10)
window 1,@"Validate ISIN"
//Test data
CFStringRef cc(6) = {@"US0378331005", @"US0373831005", @"U50378331005", ¬
@"US03378331005", @"AU0000XVGZA3", @"AU0000VXGZA3", @"FR0000988040"}
for int x = 0 to 6
print cc(x),
if fn ISINisValid(cc(x)) then print @"Valid" else print @"Invalid"
next
handleEvents