str = strrep('str1','old_str','new_str')
str = strrep('str1','old_str','new_str')
replaces all occurrences of a substring with another string, where
str1
is the string in which to search and replace.old_str
is the substring to replace within str1
.new_str
is the string that replaces old_str
.str
.
s1 = 'This is a good example.';
str = strrep(s1,'good','great')
str =
This is a great example.
findstr
(c) Copyright 1994 by The MathWorks, Inc.