Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string ReplaceTokens(string template, Dictionary<string, string> replacements)
- {
- var rex = new Regex(@":{([^}]+)}”);
- return(rex.Replace(template, delegate(Match m)
- {
- string key = m.Groups[1].Value;
- string rep = replacements.ContainsKey(key)? replacements[key] : m.Value;
- return(rep);
- }));
- }
- var saida = ReplaceTokens(stringDoArquivo, dicionarioValores);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement