Pular para o conteúdo principal
Versão: main (dev) 🚧

ITLab.Template.DevPack.Formatters

Provides tokenization and value-extraction utilities for template-style formatted strings.

Componentes

TipoNomeResponsabilidade
EnumEFormatStringTokenTypeClassifies a token as ConstantText or DynamicValue
ClassFormatStringTokenRepresents a single parsed token with its type and raw text
ClassFormattedStringValueExtracterParses a format template and extracts dynamic values from a matching input string

Como usar

// Extract dynamic segments from a known string template.
var tokens = FormattedStringValueExtracter.Extract(
input: "Order-12345-Confirmed",
format: "Order-{orderId}-{status}");

var orderId = tokens["orderId"]; // "12345"
var status = tokens["status"]; // "Confirmed"

O que não fazer

  • Do not use these formatters as a general-purpose template engine for rendering HTML or SQL.
  • Do not rely on FormattedStringValueExtracter for security-sensitive parsing — it performs no sanitization.

Extensão pelo produto

  • Products can build notification message builders on top of FormattedStringValueExtracter to bind dynamic data into predefined message templates.