OutParser is a nuget library enabling simple string parsing following a simple template pattern.
Example usage:
using OutParsing;
string input = "I selected 69";
OutParser.Parse(input, "I selected {value}", out int value);
Console.WriteLine(value); // Prints 69
OutParser requires .NET 9.0 as it makes use of Interceptors. The recommended way to add OutParser to your project is to install it from nuget.
OutParser supports anything that implements IParseable and ISpanParseable, which includes many common types in .NET. This also means you can use your own types by having them implement either of the two interfaces.
The parser supports Lists and Arrays. A separator is provided after the colon in the template string, like this: OutParser.Parse("1,2,3", "{numbers:,}", out List<int> values);
.