diff options
| author | Abigail <abigail@abigail.be> | 2021-10-19 20:13:33 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-10-19 20:25:58 +0200 |
| commit | 210e271ec3014cf6f08e9ce5d3e2ffbd92a61619 (patch) | |
| tree | c1cc76b4f9b6e317f74e96487de3cb9054e86acd /challenge-135/abigail/ruby/ch-2.rb | |
| parent | ec0548d9d1f8f277a0cd78d5a626c4efdd42f3ef (diff) | |
| download | perlweeklychallenge-club-210e271ec3014cf6f08e9ce5d3e2ffbd92a61619.tar.gz perlweeklychallenge-club-210e271ec3014cf6f08e9ce5d3e2ffbd92a61619.tar.bz2 perlweeklychallenge-club-210e271ec3014cf6f08e9ce5d3e2ffbd92a61619.zip | |
Last character of a SEDOL must be a number.
Without this check, it could validate the SEDOL which uses a letter
as a check digit. For instance, if the check digit is a '1',
using 'B' would validate as well.
Diffstat (limited to 'challenge-135/abigail/ruby/ch-2.rb')
| -rw-r--r-- | challenge-135/abigail/ruby/ch-2.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-135/abigail/ruby/ch-2.rb b/challenge-135/abigail/ruby/ch-2.rb index e77981d64a..da2f131c28 100644 --- a/challenge-135/abigail/ruby/ch-2.rb +++ b/challenge-135/abigail/ruby/ch-2.rb @@ -13,7 +13,7 @@ w = [1, 3, 1, 7, 3, 9, 1] ARGF . each_line do | line | line . strip! - if line . match (/^[0-9BCDFGHJKLMNPQRSTVWXYZ]/) then + if line . match (/^[0-9BCDFGHJKLMNPQRSTVWXYZ]{6}[0-9]$/) then check = 0 line . split('') . each_with_index do | char, i | |
