Lightweight parser for GS1 strings to be used in .NET applications.
The library is available via NuGet packages:
| NuGet | Description | Version |
|---|---|---|
| SimpleSoft.Gs1Parser | parser implementation for standard GS1 codes |
Install-Package SimpleSoft.Gs1Parserdotnet add package SimpleSoft.Gs1ParserThis library is compatible with the following frameworks:
SimpleSoft.Gs1Parser- .NET 5.0+;
- .NET Framework 4.5+;
- .NET Standard 1.0+;
Parsing of GS1 strings are made via Gs1Parser instances, that can be configured via Gs1ParserOptions class.
vargs1Parser=newGs1Parser(newGs1ParserOptions{Separator=';'});vargs1=gs1Parser.Parse("10AB111;17260630");Assert.Equal("AB111",gs1[Gs1ApplicationIdentifierType.Batch].DataContent);// gs1["10"].DataContentAssert.Equal("260630",gs1[Gs1ApplicationIdentifierType.UseBy].DataContent);// gs1["17"].DataContentThe library also provides both a default options and parser that can be used instead of initializing your own instances (the parser implementation is thread safe, you can use it as a singleton across your application):
Gs1ParserOptions.Default.Separator=';';vargs1=Gs1Parser.Default.Parse("10AB111;17260630");Assert.Equal("AB111",gs1[Gs1ApplicationIdentifierType.Batch].DataContent);Assert.Equal("260630",gs1[Gs1ApplicationIdentifierType.UseBy].DataContent);As a note, if you initialize a Gs1Parser instance without passing an options, it will use the default one.
// both lines are equivalentnewGs1Parser();newGs1Parser(Gs1ParserOptions.Default);