June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to verify that a supplied ISBN number is valid.
Manually compute and verify the check digit using Mod 11 arithmetic.
Verifying an ISBN number is similar to validating a credit card. In this case, you multiply each digit by its position (except for the last number), add together the numbers, and verify that the remainder of the sum divided by 11 matches the final check digit.
Here’s a helper function that you can use to test an ISBN:
Private Function ValidateISBN(ByVal value As String) As Boolean Dim CheckSum As Integer = 0 Dim i As Integer For i = 0 To value.Length - 2 CheckSum += Integer.Parse(value.Chars(i)) * (i + 1) Next Dim CheckDigit As Integer CheckDigit = Integer.Parse(value.Chars(value.Length ...
Read now
Unlock full access