strrep.RdFind and replace all occurrences of a substring with another one in all strings of a character vector.
strRep(s, old, new)Replaces all occurrences of old with new in all strings
of character vector s. The matching is case sensitive.
A character vector of the same length.
gsub, regexprep
S <- c('This is a good example.', "He has a good character.",
'This is good, good food.', "How goodgood this is!")
strRep(S, 'good', 'great')
#> [1] "This is a great example." "He has a great character."
#> [3] "This is great, great food." "How greatgreat this is!"