string#
Core function for string data type.
- async idem_core_functions.exec.core.string.replace(hub, data: str, to_replace: str, replace_with: str) Dict [source]#
Replace all occurrences of the given substring with another substring in the given string.
- Parameters:
- Returns:
{"result": True|False, "comment": list, "ret": None|dict}
Examples
Calling this exec module function from the cli
idem exec core.string.replace data="test_data" to_replace="test" replace_with="test_updated"
Using in a state:
Idem-state-name: exec.run: - path: core.string.replace - kwargs: data: test_data to_replace: test replace_with: test_updated