JRS: In article <11*********************@g43g2000cwa.googlegroups. com>,
dated Thu, 2 Feb 2006 00:11:13 remote, seen in
news:comp.lang.javascript, Kermit Piper <di***********@hotmail.com>
posted :
I have been searching and searching for a js function that can check
whether or not a UPC code that is entered is a valid format. I don't
expect the correct UPC code in relation to the actual product (although
we hope that is accurate), but at least check that the number entered
is in fact a valid UPC code, just like they do for credit cards. I need
this for UPC code from 8 to 13 digits in length. I found a couple
things but they didn't seem to work. They added a check digit which
didn't match the check digit on the UPC codes I got off an actual
product. Is there something out there that doesn't have to add a check
digit and that can just take the whole UPC number and check whether
it's valid or not?
Find us the specification for a UPC product code, and something could be
written.
General validation : <URL:http://www.merlyn.demon.co.uk/js-valid.htm>
ISBN validation : <URL:http://www.merlyn.demon.co.uk/js-misc0.htm>
For some systems, it's easiest to compute validity /en bloc/
For some systems, it's easiest to compute the check data needed for the
real data.
For some systems, both are easy.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.