Skip to content

Build status Coveralls branch NuGet

LSL.VariableReplacer

A library to provide variable replacement functionality. A source string can be taken by a configured variable replacer and a processed string will be returned by the use of the configured variable replacer.

Each variable value can reference other variables and a cyclic reference check will be performed upon execution of the ReplaceVariables method of a created IVariableReplacer

Quick Start

Using the default settings a variable replacer can be created with the following code:

var replacer = new VariableReplacerFactory()
    .Build(c => c.AddVariable("name", "Als"));

var result = replacer.ReplaceVariables("Hi $(name)");

// result will have the value "Hi Als"

The default settings expect a variable placeholder to be of the format $(VariableName)