function isbn10toisbn13(isbn10)
dim isbnARR(9)
for i = 0 to 9
isbnARR(i) = cint(mid(isbn10,i+1,1))
next
a = 9
b = 7
c = 8
d = isbnARR(0)
e = isbnARR(1)
f = isbnARR(2)
g = isbnARR(3)
h = isbnARR(4)
i = isbnARR(5)
j = isbnARR(6)
k = isbnARR(7)
l = isbnARR(8)
m = isbnARR(9)
n = (a*1)+(b*3)+(c*1)+(d*3)+(e*1)+(f*3)+(g*1)+(h*3)+(i*1)+(j*3)+(k*1)+(l*3)
o = 10-(n mod 10)
isbn10toisbn13 = cstr("978" & left(isbn10,9) & o)
end function
Not that this is any news to anyone - but I found myself onsite at a clients server and simply could not pull this off without the assitance of my good friend Dan Kirkwood at Eagle Innovations and just so I dont forget again here is a quick and easy bubble sort function. This one is really meant for use with a two dimensional array, the first element being numeric, which is what it will sort by.
sortthis arr
All done!
sub sortthis (byref arr) dim y, y2, fld1, fld2 fld1 = "" fld2 = "" for y = 0 to ubound(arr, 2) for y2 = y + 1 to ubound(arr, 2) if arr(0, y2) > arr(0, y) then fld1 = arr(0, y) fld2 = arr(1, y) arr(0, y) = arr(0, y2) arr(1, y) = arr(1, y2) arr(0, y2) = fld1 arr(1, y2) = fld2 end if next next end sub
function getCheckDigit(x) dim a,b,c,a2,a3 a="" b = "" c = "" a2 = "" a3 = "" dim upcARR(10) for i = 0 to 10 upcARR(i) = cint(mid(x,i+1,1)) next a = upcARR(0)+upcARR(2)+upcARR(4)+upcARR(6)+upcARR(8)+upcARR(10) a2 = a*3 a3 = upcARR(1)+upcARR(3)+upcARR(5)+upcARR(7)+upcARR(9) b = a2+a3 c = 300-b getCheckDigit = (cstr(x) & cstr(right(c,1))) end function