Validate International Securities Identification Number: Difference between revisions
Validate International Securities Identification Number (view source)
Revision as of 13:52, 30 May 2017
, 7 years ago→{{header|J}}: Update for new test cases
(→{{header|Tcl}}: add Transact-SQL) |
(→{{header|J}}: Update for new test cases) |
||
Line 889:
=={{header|J}}==
'''Solution:'''
<lang j>require'regex'
validFmt=: 0 -: '^[A-Z]{2}[A-Z0-9]{9}[0-9]{1}$'&rxindex
luhn=: 0 = 10 (| +/@,) 10 #.inv 1 2 *&|: _2 "."0\ |. NB. as per task Luhn_test_of_credit_card_numbers#J
validISIN=: validFmt *. luhn@df36</lang>
'''Required Examples:'''
<lang j> Tests=: 'US0378331005';'US0373831005';'U50378331005';'US03378331005';'AU0000XVGZA3';'AU0000VXGZA3';'FR0000988040'
validISIN&> Tests
1 0 0 0 1 1 1</lang>
=={{header|Java}}==
|