Solved

Calculate an ISBN checksum?

Posted on 1998-12-16
3
1,102 Views
Last Modified: 2008-03-10
Hello Everyone,

I am trying to automate a few things here at the office for everyone. One of my projects is to create a simple program (very simple) that calculates the checksum or check digit of an ISBN number.

For example:
If you had an ISBN number of 157521030, the checksum would be 4. I've seen examples to verify the checksum, and I've seen the mathmatical equation, but I was wondering if anyone had a simple function or routine that does this? Perhaps a pointer to one that does?

Any help or guidance would be greatly appreciated.

Sincerely,

Sandra Wallace
sandra_wallace@yahoo.com

0
Comment
Question by:sandra_wallace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:sandra_wallace
ID: 1351401
Edited text of question
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 200 total points
ID: 1351402
This function will calculate the ISBN checksum:

function ISBNCheckDigit(ISBN :string):char;
var
  CheckSum : integer;
  ModValue : Integer;

begin
  CheckSum := 10 * strtoint(ISBN[1]);
  CheckSum := checksum + 9 * strtoint(ISBN[3]);
  CheckSum := checksum + 8 * strtoint(ISBN[4]);
  CheckSum := checksum + 7 * strtoint(ISBN[6]);
  CheckSum := checksum + 6 * strtoint(ISBN[7]);
  CheckSum := checksum + 5 * strtoint(ISBN[8]);
  CheckSum := checksum + 4 * strtoint(ISBN[9]);
  CheckSum := checksum + 3 * strtoint(ISBN[10]);
  CheckSum := checksum + 2 * strtoint(ISBN[11]);
 
  ModValue := Checksum mod 11;
  if ModValue < 10 then
    result := chr(asc('0') + ModValue - 1)
  else
    result := 'X';
end;

Cheers,

Raymond.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1351403
Oops,  this line

 result := chr(asc('0') + ModValue - 1)

should read

 result := chr(ord('0') + ModValue - 1)

Cheers,

Raymond.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month6 days, 23 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question