本文介绍了如何将UPC-E条码转换为UPC-A条码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将零抑制的八位GTIN-12标识符(表示为UPC-E条形码)转换为完整的十二位版本(如UPC-A条形码所示)的算法是什么?
What is the algorithm for converting a zero-suppressed, eight-digit GTIN-12 identifier (represented as a UPC-E barcode) into the full, twelve-digit version as shown in a UPC-A barcode?
推荐答案
从以下模式映射中可以最清楚地看到在UPC-E和UPC-A表示形式之间转换GTIN-12标识符的算法:
The algorithm for converting a GTIN-12 identifier between UPC-E and UPC-A representation can be most clearly seen from the following pattern mapping:
SabcdeNX ⟺ SabN0000cdeX : 0≤N≤2
Sabcde3X ⟺ Sabc00000deX
Sabcde4X ⟺ Sabcd00000eX
SabcdeNX ⟺ Sabcde0000NX : 5≤N≤9
上面的S
是数字系统(0或1),而X
是校验位.
In the above S
is the number system (either 0 or 1) and X
is the check digit.
在伪代码中,它看起来像这样:
In pseudo-code it looks like this:
Input: A valid eight-digit UPC-E: Assigned to E[].
Output: PASS: Twelve-digit UPC-A representing the UPC-E.
FAIL: Reason.
if E[0] != {0-1} then FAIL: Invalid number system.
if E[6] == {0-2} then PASS: E[0-2] . E[6] . "0000" . E[3-5] . E[7]
if E[6] == "3" then PASS: E[0-3] . "00000" . E[4-5] . E[7]
if E[6] == "4" then PASS: E[0-4] . "00000" . E[5] . E[7]
if E[6] == {5-9} then PASS: E[0-5] . "0000" . E[6] . E[7]
这篇关于如何将UPC-E条码转换为UPC-A条码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!