ISBN Functions
by johna | July 31, 2007 | Classic ASP Web Development
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
Converting dBase IV programs to run in the browser
by johna | September 13, 2024
Some pointless entertainment trying to get some old dBase programs running in the browser.
How to set up a debugging using the Turnkey Linux LAMP stack and VS Code
by johna | December 19, 2023
The second part in my guide to setting up a website and database using the Turnkey Linux LAMP stack.
How to set up a website and database using the Turnkey Linux LAMP stack
by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).
Comments
There are no comments yet. Be the first to leave a comment!