Figuring Out the Check Digit

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

Comments


Leave a Comment

 

 







LATEST POSTS

PostBackUrl Equals Change the Friggin' Form Action . Curse you DBNull and/or Is Nothing! . Career Developers are Shitbags they are. Consolas Makes Me Geek-ier MS Consolas Font Abuse Things I Read Today and You Should Too Whilst searching for solutions I happened upon...

ADS

MOST POPULAR

Multiple IEs in Windows Firefox Vs. The World Who Is Xperya? ActionScript Form Fields Quick Watermark IE 7 beta 2 standalone

IP Address Tool Chicago Web Design Free Text Messaging