Validate International Securities Identification Number: Difference between revisions

Content deleted Content added
Langurmonkey (talk | contribs)
Langurmonkey (talk | contribs)
Line 2,102: Line 2,102:


=={{header|langur}}==
=={{header|langur}}==
The luhn test is repeated here for simplicity (from Luhn_test_of_credit_card_numbers#langur).
The luhn test is repeated here for simplicity.


<syntaxhighlight lang="langur">val .luhntest = f(.s) {
<syntaxhighlight lang="langur">val .luhntest = fn(.s) {
val .t = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
val .t = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
val .numbers = s2n .s
val .numbers = s2n .s
Line 2,118: Line 2,118:
}
}


val .isintest = f(.s) {
val .isintest = fn(.s) {
.s -> re/^[A-Z][A-Z][0-9A-Z]{9}[0-9]$/ and
.s -> re/^[A-Z][A-Z][0-9A-Z]{9}[0-9]$/ and
.luhntest(join s2n .s)
.luhntest(join s2n .s)