Skip to content

OFark/InterpolatedStringFormatter

Repository files navigation

InterpolatedStringFormatter

Interpolates strings that are formatted with named variables

Example

var mystring = "a thing(and something {other})";
Console.WriteLine(mystring.Interpolate("else"));

Outputs:

a thing(and something else)

Why ?

Because String Interpolation is done by the compiler, not at runtime.

string.Format(mystring, "else");

Gives you:

Input string was not in a correct format.

Because the format is looking for {0} and not a named variable.

Compatibility

.NetStandard 2.0

About

Interpolates strings at runtime.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages