|
The International Standard Book Number, or ISBN , is a unique identifier barcode for books, intended to be used commercially.
The ISBN system was created in the United Kingdom in 1966 by the booksellers and
stationers WH Smith and was originally a 9-digit code called Standard Book Numbering or
SBN (still used in 1974).
It was adopted as international standard ISO 2108 in 1970.
From January 1, 2007, ISBNs are 13 digits long and the same as in Bookland EAN-13
A similar identifier, the International Standard Serial Number (ISSN), is used for periodical publications such as magazines.
|
To change an ISBN-10 to an ISBN-13, follow
these three basic steps:
-
Drop the check
digit (the last digit) from your existing ISBN-10. For example, your ISBN-10 is 0123456789. By dropping the check digit (9), you get a 9-digit number, 012345678.
-
Add the prefix “978” to the beginning of your 9-digit number. Your 9-digit 012345678
now becomes 12 digits, 978012345678.
-
Recalculate your check digit using the
modulus 10 check digit routine. You get
6.
-
Add the check digit to the end of the 12-digit number created in Step
-
The conversion from an ISBN-10 to an ISBN-13 is complete. The ISBN-13 becomes 9780123456786
Here is the C# version of the Conversion Algorithm:
public String convertIsbnFrom10To13(String isbn10)
{
if (isbn10.Length != 10)
return null;
String dest = null;
int sum = 0;
try
{
if (isbn10 != null)
{
String isbn = "978" + isbn10.Substring(0, 9);
if (isbn.Length == 12)
{
for (int i = isbn.Length; i > 0; i--)
{
int nr = Convert.ToInt32(isbn.Substring(i - 1, 1));
if (i % 2 == 0)
nr = nr * 3;
sum = sum + nr;
}
int digControl = (10 - (sum % 10)) % 10;
dest = isbn + digControl.ToString();
}
else
{
dest = null;
}
}
else
{
dest = null;
}
}
catch
{
dest = null;
}
return dest;
}
|
|