commonutil.dmacro

錢字符號為前置字串的巨集處理 / Dollar-sign prefixed macro processing

replace_macro(tpl_text, macro_map, placeholder_for_empty_macro=True)[source]

進行字串巨集替換

Perform macro content substitute

Parameters:
  • tpl_text – 樣板文字 / Template text contains macro tags
  • macro_map – 巨集值對應字典 / Content map of macro
  • placeholder_for_empty_macro=True – 是否使用巨集鍵作為找不到巨及對應值時的值 / Use macro key for content of macro content not reachable from content map
Returns:

取代巨集後的字串 / Resulted text of macro replacement