Validate International Securities Identification Number: Difference between revisions
Validate International Securities Identification Number (view source)
Revision as of 15:52, 30 April 2024
, 18 days ago→{{header|langur}}
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2,102:
=={{header|langur}}==
The luhn test is repeated here for simplicity
<syntaxhighlight lang="langur">val .luhntest =
val .t = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
val .numbers = s2n .s
Line 2,110:
for[=0] .i of .numbers {
_for += if
.numbers[.i]
} else {
.t[.numbers[.i]+1]
}
} div 10
}
val .isintest =
.s -> re/^[A-Z][A-Z][0-9A-Z]{9}[0-9]$/ and
.luhntest(join s2n .s)
}
val .tests =
"US0378331005": true,
"US0373831005": false,
|