/// <summary> /// Substitutes $(x) values in stringValue, the delegate specified in lookupCallback is called for each match allowing /// custom lookup and formatting to be performed /// </summary> /// <param name="stringValue">the string to replace $(x) values in</param> /// <param name="lookupCallback">Delegate that receives the name of the value to lookup</param> /// <returns>stringValue with the $(x) values replaced with substitutes when found</returns> public static string Substitute(string stringValue, ReplacementLookup lookupCallback) { return Substitute(stringValue, lookupCallback, DefaultLeftEnclose, DefaultRightEnclose); }
/// <summary> /// Substitutes $(x) values in stringValue, the delegate specified in lookupCallback is called for each match allowing /// custom lookup and formatting to be performed /// </summary> /// <param name="stringValue">the string to replace $(x) values in</param> /// <param name="lookupCallback">Delegate that receives the name of the value to lookup</param> /// <param name="leftEnclose">the left encloser (e.g. '$(')</param> /// <param name="rightEnclose">the right encloser (e.g. ')')</param> /// <returns>stringValue with the $(x) values replaced with substitutes when found</returns> public static string Substitute(string stringValue, ReplacementLookup lookupCallback, string leftEnclose, string rightEnclose) { CustomMatchEvaluator evaluator = new CustomMatchEvaluator(leftEnclose, rightEnclose, lookupCallback); return Substitute(stringValue, leftEnclose, rightEnclose, evaluator.EvaluateMatch); }
public CustomMatchEvaluator(string leftEnclose, string rightEnclose, ReplacementLookup replacementLookupDel) : base(leftEnclose, rightEnclose) { _replacementLookupDel = replacementLookupDel; }