SmartStrings is a lightweight string templating library for C# with support for named placeholders, format specifiers, culture support, and ASP.NET Core integration.
$ dotnet add package SmartStringsSmartStrings is a lightweight and intuitive C# string templating library. It adds extension methods like .Fill() that let you replace placeholders in strings using objects, dictionaries, or parameter arrays — with optional fallbacks.
💡 Inspired by the flexibility of
$"{name}", but better suited for dynamic or external templates.
{name}, {plan}, etc.{name:Guest} syntaxnull, missing keys, and extra placeholders gracefullyusing SmartStrings;
var template = "Welcome, {user}!";
var result = template.Fill("Alice");
// Result: "Welcome, Alice!"
const string template = "Hi {name:Guest}, welcome!";
var result = template.Fill(new { });
// Result: "Hi Guest, welcome!"
dotnet add package SmartStrings
📚 Full source, license, and documentation available at
github.com/jonatasolmartins/smart-strings