Validate International Securities Identification Number: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→{{header|REXX}}: formatting corrected) |
(Added Uiua solution) |
||
Line 3,289: | Line 3,289: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Uiua}}== |
|||
<syntaxhighlight lang="uiua"> |
|||
Base ← "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|||
Luhn ← =0◿10+⊃(/+⊢|/+∵(⍥(-9)>9.×2)⊡1)⍉⬚0↯∞_2⇌ |
|||
Checksum ← Luhn≡⋕/◇⊂≡(□°⋕⊗)⊙(¤Base) |
|||
Format ← ××⊃(/×≡(≥@A)↙2|=12⧻|/↧∊:Base) |
|||
Valid ← ×⊃(Format|Checksum) |
|||
Tests ← { |
|||
"AU0000XVGZA3" |
|||
"US0378331005" |
|||
"US0373831005" # twiddled |
|||
"U50378331005" # 5 rather than S |
|||
"US03378331005" # Extra char |
|||
"AU0000XVGZA3" |
|||
"AU0000VXGZA3" |
|||
"FR0000988040" |
|||
"F00Ö00988040" # Illegal char |
|||
} |
|||
≡◇Valid Tests |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
[1 1 0 0 0 1 1 1 0] |
|||
</pre> |
|||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
<syntaxhighlight lang="vb">' Validate International Securities Identification Number - 03/03/2019 |
<syntaxhighlight lang="vb">' Validate International Securities Identification Number - 03/03/2019 |