replace
Replaces all occurrences of a substring in a string
with a replacement string
.
replace(searchString, substring, replacement)
#
ParameterssearchString
: Thestring
to search withinsubstring
: Thestring
to find insearchString
replacement
: Thestring
to replace for each match ofsubstring
#
Returns- The replaced
string
#
Exampleprint(replace("Some dogs are funny. Some dogs are serious", 'dogs', 'cats'))# prints: Some cats are funny. Some cats are serious