hpcflow.sdk.core.utils.substitute_string_vars#

hpcflow.sdk.core.utils.substitute_string_vars(string, variables, used=None)#

Scan string and substitute sequences like <<var:ABC>> with the value looked up in the supplied dictionary (with ABC as the key).

Default values for the substitution can be supplied like: <<var:ABC[default=XYZ]>>

If used is given, it is updated with the value substituted for each variable name (including any default values used).

Examples

>>> substitute_string_vars("abc <<var:def>> ghi", {"def": "123"})
"abc 123 def"
Parameters: