using System.Collections.Generic; using System.Text.RegularExpressions; namespace YBEE.EQM.Core { /// /// 宏替换 /// public class MacroReplacement { /// /// 宏替换 /// /// 要替换的字符串 /// 宏字典 /// public static string Replace(string input, Dictionary macros) { foreach (var macro in macros) { var regex = new Regex(macro.Key); input = regex.Replace(input, macro.Value); } return input; } } }