## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Validate an ISBN

## Problem

You want to verify that a supplied ISBN number is valid.

## Solution

Manually compute and verify the check digit using Mod 11 arithmetic.

## Discussion

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 ...`

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required