ISBN Functions

John Avis by | July 31, 2007 | Classic ASP

This Classic ASP function will convert your old 10 digit ISBN numbers to the new ISBN-13 standard. It requires one parameter: either a 9 or 10 digit ISBN-10.
ISBN-10 to ISBN-13 Conversion and Check Digit Calculation

fnisbn13

This Classic ASP function will convert your old 10 digit ISBN numbers to the new ISBN-13 standard. It requires one parameter: either a 9 or 10 digit ISBN-10.

function fnisbn13(strparam1)
vari=0
varv=0
varn=0
varc=""
varResult=""
vars12=""
varISBN10=strparam1
varlen=len(varISBN10)
if varlen<9 or varlen>10 then
varResult="ERROR"
else
vars12="978"+left(varISBN10,9)
for vari=0 to 11
if varResult="" then
varc=mid(vars12,vari+1,1)
if varc>="0" and varc<="9" then
varv=varc-0
if vari mod 2<>0 then varv=3*varv
varn=varn+varv
end if
else
varResult="ERROR"
end if
next
if varResult="" then
varn=varn mod 10
if varn<>0 then varn=10-varn
varResult=vars12 & varn
end if
end if
fnisbn13=varResult
end function

Related Posts

Classic ASP

Sending email using Amazon SES with Classic ASP

by John Avis | March 21, 2017

I recently needed to change a client's website to send emails using Amazon SES and encountered a few issues.


Classic ASP

Classic ASP class constructors with parameters

by John Avis | June 8, 2016

Although probably no one cares about Classic ASP, except those who still need to support it, I was refreshing my memory today on how to use classes in Classic ASP and found a couple of options for simulating constructors with parameters.


Classic ASP

Classic ASP cookie with no name hacking attack causing error 80004005

by John Avis | July 31, 2015

As of July 2015, many of my Classic ASP websites have started logging strange errors, either 80004005 or not reporting any error code at all.

Comments

There are no comments yet. Be the first to leave a comment!

Leave a Comment
Tags
ASP.NET Html Forms ASP.NET MVC ASP.NET Web Forms ASP.NET Web Pages Bootstrap C# Classic ASP Cool Websites Databases eBay and PayPal Electrical Repairs General Hardware HTML/CSS Jquery/Javascript Media Center Mobile Phones Responsive Web Design SEO and Social Networking Web Design Web Development Web Security web+db Website Hosting Windows XP Youtube

About me

...mostly about web development and programming, with a little bit of anything else related to the Internet, computers and technology.

Subscribe

Get the latest posts delivered to your inbox.