GTIN - UPC-A & UPC-E (8 Digit UPC) Validation and Check Digit Calculation

Mindwatering Incorporated

Author: Tripp W Black

Created: 03/03/2008 at 02:13 PM

 

Category:
Notes Developer Tips
JavaScript

Issue: Need to Validate standard GTIN/UPC-A and 8-digit UPC (UPC-E) Code:
- validate length = 8, 11,12,14
- if UPC-E:
- - validate 1st digit = 0 (otherwise it is not a UPC-E US code)
- - convert UPC-E length to UPC-A
- validate UPC digits = checkdigit

Solution:

gtin-validation-js.txt

previous page