in src/log4net/Util/OptionConverter.cs [334:379]
public static string SubstituteVariables(string value, System.Collections.IDictionary props)
{
value.EnsureNotNull();
props.EnsureNotNull();
StringBuilder buf = new();
int i = 0;
int j, k;
while (true)
{
j = value.IndexOf(DelimStart, i, StringComparison.Ordinal);
if (j == -1)
{
if (i == 0)
{
return value;
}
else
{
buf.Append(value.Substring(i, value.Length - i));
return buf.ToString();
}
}
else
{
buf.Append(value.Substring(i, j - i));
k = value.IndexOf(DelimStop, j);
if (k == -1)
{
throw new LogException("[" + value + "] has no closing brace. Opening brace at position [" + j + "]");
}
else
{
j += DelimStartLen;
string key = value.Substring(j, k - j);
if (props[key] is string replacement)
{
buf.Append(replacement);
}
i = k + DelimStopLen;
}
}
}
}