Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/atulin/forged/llms.txt

Use this file to discover all available pages before exploring further.

Forged ships a set of string-specific extension methods that slot directly into any Generator<string> pipeline. Each method wraps the upstream generator in a dedicated transformer class — UppercaseGenerator, LowercaseGenerator, TitleCaseGenerator, CapitalizeGenerator, and SentencifyGenerator — and returns a new Generator<string>, so you can continue chaining further modifiers after them.
These extensions are defined using the C# 14 extension member syntax inside StringGeneratorExtensions. This means your project must target .NET 10 or later and use the C# 14 language version. Earlier toolchains will not compile them.

Case conversion

.ToUpper()

Converts every generated string to uppercase using the invariant culture (string.ToUpperInvariant()). Returns Generator<string>
// Generate a 6-character uppercase identifier
Code = f => f.Text.Alpha(6).ToUpper(),

.ToLower()

Converts every generated string to lowercase using the invariant culture (string.ToLowerInvariant()). Returns Generator<string>
// Lowercase email local-part
Email = f => f.Person.FirstName().ToLower()
    .Refine(name => $"{name}@example.com"),

.ToTitleCase(CultureInfo? cultureInfo = null)

Converts every generated string to title case using TextInfo.ToTitleCase from the supplied (or forge-default) culture.
cultureInfo
CultureInfo?
The culture whose TextInfo is used for the conversion. When null, falls back to the Forge instance’s configured locale.
Returns Generator<string>
// "the quick brown fox" → "The Quick Brown Fox"
BookTitle = f => f.Lorem.Words(4)
    .Refine(ws => string.Join(' ', ws))
    .ToTitleCase(),

Capitalization

.Capitalize(CultureInfo? cultureInfo = null)

Uppercases only the first character of the generated string, leaving all remaining characters untouched. This is distinct from .ToTitleCase(), which uppercases the first letter of every word.
cultureInfo
CultureInfo?
The culture to use when uppercasing the first character. When null, falls back to the Forge instance’s configured locale.
Returns Generator<string>
// "alice" → "Alice"
FirstName = f => f.Text.Pronounceable(1, 3).ToLower().Capitalize(),

Sentence formatting

.Sentencify(int sentenceLength, CultureInfo? cultureInfo = null)

Takes a generated string (treated as a sequence of space-separated words) and formats it as one or more sentences: the first word of each sentence is capitalized and sentences end with a period. Each sentence is exactly sentenceLength words long.
sentenceLength
int
required
The fixed number of words per sentence.
cultureInfo
CultureInfo?
The culture to use for first-letter capitalization. Falls back to the Forge locale when null.
Returns Generator<string>
// Fixed 6-word sentences
Bio = f => f.Lorem.Paragraph().Sentencify(6),

.Sentencify(int minSentenceLength, int maxSentenceLength, CultureInfo? cultureInfo = null)

Same as the single-length overload, but the number of words per sentence is chosen randomly within the inclusive [minSentenceLength, maxSentenceLength] range on each generation call, giving more natural-sounding output.
minSentenceLength
int
required
The minimum number of words per sentence (inclusive).
maxSentenceLength
int
required
The maximum number of words per sentence (inclusive).
cultureInfo
CultureInfo?
The culture to use for first-letter capitalization. Falls back to the Forge locale when null.
Returns Generator<string>
// Variable-length sentences, between 5 and 12 words each
Description = f => f.Lorem.Paragraph().Sentencify(5, 12),

Chaining example

All string extension methods return Generator<string>, so they can be freely chained with each other and with any other Generator<T> modifier:
FirstName = f => f.Text
    .Pronounceable(1, 3)
    .ToLower()
    .Capitalize(),
Username = f => f.Text
    .Alpha(8)
    .ToLower()
    .Refine(s => $"user_{s}"),

Build docs developers (and LLMs) love