pub fn replace(
state: &mut State<'_, '_>,
value: StringInput<'_>,
from: StringInput<'_>,
to: StringInput<'_>,
) -> Result<Value, Error>Expand description
Does a string replace.
It replaces all occurrences of the first parameter with the second.
If the optional third parameter count is given, only that many
occurrences are replaced. A negative count replaces all occurrences.
The count can also be passed as keyword argument.
{{ "Hello World"|replace("Hello", "Goodbye") }}
-> Goodbye World
{{ "aaa"|replace("a", "b", 2) }}
-> bba
{{ "aaa"|replace("a", "b", count=1) }}
-> baaWhen called directly from Rust, this function always replaces all occurrences.