TicketCode 0.0.1
dotnet add package TicketCode --version 0.0.1
NuGet\Install-Package TicketCode -Version 0.0.1
<PackageReference Include="TicketCode" Version="0.0.1" />
<PackageVersion Include="TicketCode" Version="0.0.1" />
<PackageReference Include="TicketCode" />
paket add TicketCode --version 0.0.1
#r "nuget: TicketCode, 0.0.1"
#:package TicketCode@0.0.1
#addin nuget:?package=TicketCode&version=0.0.1
#tool nuget:?package=TicketCode&version=0.0.1
TicketCode
Still in development
TicketCode is a simple .NET library meant to help generate codes for tickets, coupons, or IDs based on pattern expressions. This project is not meant to be revolutionary or ambitious — just a small tool to make life a bit easier if you need to generate codes in a flexible way using an easy DSL. The project is evolving and may change a lot over time.
Features
- Simple pattern-based syntax (DSL)
- Supports: uppercase letters (
$l(u)
), lowercase letters ($l(l)
), mixed-case letters ($l
), digits ($n
), alphanumerics ($a
), day ($dd
), month ($mm
), year ($yy
,$yyyy
) - Modifiers:
(u)
for uppercase,(l)
for lowercase (e.g.,$l(u){4}
) - Quantifiers:
{n}
for repeating n times (e.g.,$a{8}
) - Extensible: add new tokens easily
- .NET Standard 2.0 compatible
- 100% open source
Pattern Syntax Examples
$l(u){3}$n{4}-$yy
→XJQ4821-24
$l(l){2}$l(u){2}$n{2}
→abCD71
$yyyy$mm$dd-$l(u){5}
→20250709-WVUKR
TCK-$l(u){2}$n{3}
→TCK-GM572
$a{8}
→B2t7y3Qk
$a(u){6}
→JSNQKD
$a(l){6}
→mnxwqe
Usage
using TicketCode;
Console.WriteLine(TicketCodeFactory.Generate("TICKET-$yyyy-$mm-$l(u){10}"));
Console.WriteLine(TicketCodeFactory.Generate("CUPOM-$yyyy-$a(u){10}"));
Console.WriteLine(TicketCodeFactory.Generate("$yyyy$mm-$a(u){7}-SALES"));
Console.WriteLine(TicketCodeFactory.Generate("PROMO-$yyyy-$a(u){7}"));
Console.WriteLine(TicketCodeFactory.Generate("PROMO-$mm$yy-$a(u){7}"));
//TICKET-2025-07-GXXDKWXAZZ
//CUPOM-2025-JS6B7A4984
//202507-6O22IP9-SALES
//PROMO-2025-W1XGC1K
//PROMO-0725-6715595
Supported Tokens
Token | Description |
---|---|
$l |
Letter (A–Z, a–z) |
$l(u) |
Uppercase letter (A–Z) |
$l(l) |
Lowercase letter (a–z) |
$a |
Letter or digit (A–Z, a–z, 0–9) |
$a(u) |
Uppercase letter or digit (A–Z, 0–9) |
$a(l) |
Lowercase letter or digit (a–z, 0–9) |
$n |
Digit (0–9) |
$dd |
Day (two digits) |
$mm |
Month (two digits) |
$yy |
Year (last two digits) |
$yyyy |
Year (four digits) |
Quantifiers
TicketCode lets you specify how many times each token is repeated, using {n}
after the token.
Examples:
$l(u){5}
→QKMTN
(five uppercase letters)$n{4}
→2941
(four digits)$a{8}
→mY72tFaW
(eight alphanumeric characters)
You can freely combine quantifiers with other tokens, modifiers, and static text to create any patterns you need.
Requirements
- .NET Standard 2.0+
- Antlr4.Runtime.Standard
License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Antlr4.Runtime.Standard (>= 4.13.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.0.1 | 93 | 7/13/2025 |