search for: nhs_no

Displaying 1 result from an estimated 1 matches for "nhs_no".

Did you mean: nb_no
2007 Apr 18
2
Checking validity of NHS numbers
...nder 4. subtract the remainder from 11 to give the check digit. If the result of step 4 is 11 a check digit of 0 is used; if the result is 10 then the number is invalid. I''m struggling to implement this into my model. I imagine that the first thing is to convert the string to an array: nhs_no = "1234567890" nhs_no.split("").map{ |v| v.to_i } # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] Then I get a bit stuck (i.e. before step 1!): I want to transform the first nine digits of the array so that the new value of the kth element is v*(10-k). I hope this makes some sense, an...