strReplace

Syntax

strReplace(str, pattern, replacement)

Arguments

str is a string scalar/vector.

pattern and replacement are both string scalars.

Details

Return a copy of str and replace all occurrences of pattern with replacement.

Examples

$ strReplace("The ball is red.", "red", "green");
The ball is green.

$ strReplace(["The ball is red.", "The car is red too."], "red", "yellow");
["The ball is yellow.","The car is yellow too."]