zplCore.comzplCore.com

Gs1Builder

public static class Gs1Builder

Helpers to build GS1 element strings ("(AI)value…") for the GS1 symbologies.

Methods

Method SignatureReturnsDescription
static # Build(params (string, string)[] elements)stringElement string of (AI, value) pairs, e.g. Build(("01", gtin), ("10", "LOT1")).
static # CheckDigit(string digits)intGS1 mod-10 check digit of a digit string (GTIN, SSCC, GLN …).
static # Date(string ai, DateOnly date)stringDate AI value YYMMDD, e.g. Date("17", expiry) for (17) expiration date.
static # Element(string ai, string value)stringOne element "(AI)value".
static # Gtin(string gtin)stringAI (01): GTIN-8/12/13/14 padded to 14 digits; a 7/11/12/13-digit input gets its check digit.
static # IsKnownAi(string ai)boolTrue when the AI is defined in the GS1 table.
static # IsValidCheckDigit(string digitsWithCheck)boolTrue when the last digit is the correct GS1 check digit.
static # Measure(string ai3, decimal value, int decimals)stringMeasure AI with implied decimal point: ai3 is the 3-digit base (e.g. "310" net weight kg), the 4th digit is the number of decimals; value padded to 6 digits. Measure("310", 1.5m, 3) → "(3103)001500".
static # Sscc(string sscc)stringAI (00): SSCC from 17 digits (check digit added) or 18 digits (validated).
static # WithCheckDigit(string digits)stringDigits with their GS1 check digit appended.