A parser for GS1-128 (formerly UCC/EAN-128) element strings. These strings use the Application Identifier (AI) encoding on logistics and retail barcodes.
parse accepts the human-readable parenthesized form or the raw scanned form.
In the raw form, FNC1 (the ASCII group separator 0x1D) ends a variable-length
field. parse returns a vector of segment maps, in order:
(parse "(01)09521234543213(15)170331(10)ABC123")
;=> [{:ai "01" :label "GTIN" :value "09521234543213"}
; {:ai "15" :label "BEST BEFORE" :value "170331"}
; {:ai "10" :label "BATCH/LOT" :value "ABC123"}]
Weight, measure, and amount AIs carry an implied decimal place: the last digit
of the AI. Those segments also report :decimals and a numeric
:decimal-value.
A parser for GS1-128 (formerly UCC/EAN-128) element strings. These strings use
the Application Identifier (AI) encoding on logistics and retail barcodes.
`parse` accepts the human-readable parenthesized form or the raw scanned form.
In the raw form, FNC1 (the ASCII group separator 0x1D) ends a variable-length
field. `parse` returns a vector of segment maps, in order:
(parse "(01)09521234543213(15)170331(10)ABC123")
;=> [{:ai "01" :label "GTIN" :value "09521234543213"}
; {:ai "15" :label "BEST BEFORE" :value "170331"}
; {:ai "10" :label "BATCH/LOT" :value "ABC123"}]
Weight, measure, and amount AIs carry an implied decimal place: the last digit
of the AI. Those segments also report `:decimals` and a numeric
`:decimal-value`.(parse s)Parse a GS1-128 element string (parenthesized or raw/FNC1 form) into an ordered
vector of {:ai :label :value (:decimals :decimal-value)} segments.
Parse a GS1-128 element string (parenthesized or raw/FNC1 form) into an ordered
vector of `{:ai :label :value (:decimals :decimal-value)}` segments.(parse-map s)Like parse, but returns a map of AI string -> value (last wins on repeats).
Like `parse`, but returns a map of AI string -> value (last wins on repeats).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |